package com.print;

import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
import com.model.wg.*;
import com.model.ynk.*;
import com.sun.xml.internal.fastinfoset.stax.events.Util;
import com.swetake.util.Qrcode;
import com.util.JackUtil;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;

import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
import java.util.List;

/**
 * 客户端标签打印
 * 
 * @author 
 * 
 */
public class LabelApplet4JX extends JApplet {

	private static final long serialVersionUID = -6391368515081034834L;

	public void print1(final String info) throws Exception {
		AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
			@Override
			public Object run() throws Exception {
				Label label = new Label();
				label.addDMCode(new DMCode(2, 2, 2, info));
				label.print();
				label.dispose();
				return null;
			}
		});
	}

	public void PrintJX4BS(final String customer_id, final String mode_id, final String date, final String prd_spec,
			final String wo_id, final String woCnt, final String jsonCntAry, final String boxRule, final String totalCnt,
			final String jsonAry, final String layout_cnt, final String mtrl_id, final String habk_id) {
		ObjectMapper mapper = new ObjectMapper();
		String[] ja = null;
		String[] jaCnt = null;
		int loopCnt;
		int li;
		int index;
		try {
			ja = mapper.readValue(jsonAry, String[].class);
		} catch (Exception e) {
			System.out.println("Error took place");
			e.printStackTrace();
		}
		try {
			jaCnt = mapper.readValue(jsonCntAry, String[].class);
		} catch (Exception e) {
			System.out.println("Error took place");
			e.printStackTrace();
		}
		System.out.println("Start");
		double len = ja.length;
		System.out.println(len);

		loopCnt = (int) Math.ceil(len / 12);
		System.out.println(Math.ceil(len / 12));
		System.out.println(len / 12);
		System.out.println(loopCnt);

		for (li = 0; li < loopCnt; li++) {
			LabelJX label = new LabelJX(212, 290, 300);
			int j = 0;
			int k = 0;
			int lj = 0;
			double step = 5;
			double _y = 6.5;
			double _yy = 12.9;
			double Max_y = 72.8;
			for (lj = 0; lj < 12; lj++) {
				index = li * 12 + lj;
				if (index >= ja.length) {
					break;
				}
				j = lj % 3;
				/**
				 * 横坐标值
				 */
				double x1 = 3.8 + 69 * j;
				double x2 = 24.3 + 69 * j;
				double x3 = 2 + 69 * j;
				double x4 = 23 + 69 * j;
				double x5 = 9.8 + 69 * j;
				double x6 = 29.8 + 69 * j;
				/**
				 * 纵坐标值
				 */
				k = lj / 3;
				double y1 = 8 + k * Max_y;
				double y2 = 6.8 + k * Max_y;
				double y3 = _y + Max_y * k + step;
				double y4 = _y + Max_y * k + 2 * step;
				double y5 = _y + Max_y * k + 3 * step;
				double y6 = _y + Max_y * k + 4 * step;
				double y7 = _y + Max_y * k + 5 * step;
				double y8 = _y + Max_y * k + 6 * step;
				double y9 = _y + Max_y * k + 7 * step;
				double ya = _y + Max_y * k + 8 * step;
				double yb = _y + Max_y * k + 9 * step;
				double yA = _y + Max_y * k + 10 * step;
				double yB = 3.3 + k * Max_y;
				double yC = 59.1 + k * Max_y;
				/**
				 * Line的纵坐标值
				 */
				double _yy1 = _yy + k * Max_y;
				double _yy2 = _yy + k * Max_y + step;
				double _yy3 = _yy + k * Max_y + 2 * step;
				double _yy4 = _yy + k * Max_y + 3 * step;
				double _yy5 = _yy + k * Max_y + 4 * step;
				double _yy6 = _yy + k * Max_y + 5 * step;
				double _yy7 = _yy + k * Max_y + 6 * step;
				double _yy8 = _yy + k * Max_y + 7 * step;
				double _yy9 = _yy + k * Max_y + 8 * step;
				double _yy0 = _yy + k * Max_y + 9 * step;

				label.addRectangle(new Rectangle(x3, y1, 67, 64.2, 0.2));
				label.addLine(new Line(x4, y1, 50, 0.2, -90));

				label.addText(new Text(x1, yB, "宋体", 2, 14, "WG•TECH"));
				label.addText(new Text(x5, y2, "宋体", 0, 10, "沃格光电"));
				label.addText(new Text(x6, y2, "宋体", 0, 14, "原料来料标签"));

				label.addText(new Text(x1, y3, "宋体", 0, 12, "客户代码"));
				label.addText(new Text(x2, y3, "Arial", 0, 12, customer_id));
				label.addLine(new Line(x3, _yy1, 67, 0.2, 0));

				label.addText(new Text(x1, y4, "宋体", 0, 12, "客户型号"));
				label.addText(new Text(x2, y4, "宋体", 0, 12, mode_id + "(" + layout_cnt + "模)"));
				label.addLine(new Line(x3, _yy2, 67, 0.2, 0));

				label.addText(new Text(x1, y5, "宋体", 0, 12, "料号"));
				label.addText(new Text(x2, y5, "宋体", 0, 12, mtrl_id));
				label.addLine(new Line(x3, _yy3, 67, 0.2, 0));

				label.addText(new Text(x1, y6, "宋体", 0, 12, "手册号"));
				label.addText(new Text(x2, y6, "宋体", 0, 12, habk_id));
				label.addLine(new Line(x3, _yy4, 67, 0.2, 0));

				label.addText(new Text(x1, y7, "宋体", 0, 12, "来料日期"));
				label.addText(new Text(x2, y7, "Arial", 0, 12, date));
				label.addLine(new Line(x3, _yy5, 67, 0.2, 0));

				label.addText(new Text(x1, y8, "宋体", 0, 12, "规格"));
				label.addText(new Text(x2, y8, "Arial", 0, 12, prd_spec));
				label.addLine(new Line(x3, _yy6, 67, 0.2, 0));

				label.addText(new Text(x1, y9, "宋体", 0, 12, "生产订单号"));
				label.addText(new Text(x2, y9, "Arial", 0, 12, wo_id));
				label.addLine(new Line(x3, _yy7, 67, 0.2, 0));

				label.addText(new Text(x1, ya, "宋体", 0, 12, "订单数量"));
				label.addText(new Text(x2, ya, "Arial", 0, 12, woCnt));
				label.addLine(new Line(x3, _yy8, 67, 0.2, 0));

				label.addText(new Text(x1, yb, "宋体", 0, 12, "本箱数量"));
				label.addText(new Text(x2, yb, "Arial", 0, 12, jaCnt[index]));
				label.addLine(new Line(x3, _yy9, 67, 0.2, 0));

				label.addText(new Text(x1, yA, "宋体", 0, 12, "箱号"));
				label.addText(new Text(x2, yA, "Arial", 0, 12, (Integer.parseInt(boxRule) + index) + " / " + totalCnt));
				label.addLine(new Line(x3, _yy0, 67, 0.2, 0));

				Code code = new Code(x1, yC, 12, 0.30, ja[index]);
				try {
					label.addCode128(code);
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			try {
				label.print();
			} catch (Exception e) {
				e.printStackTrace();
			}
			label.dispose();
		}
	}

	public void PrintBacth(final String batch_id) {
		LabelJX label = new LabelJX(65, 15, 203);
		Code code = new Code(4, 2.5, 10, 0.22, batch_id);
		try {
			label.addCode(code);
		} catch (IOException e) {
			e.printStackTrace();
		}
		try {
			System.out.println("before");
			label.print();
			System.out.println("after");
		} catch (Exception e) {
			e.printStackTrace();
		}
		label.dispose();
	}

	public void PrintJDF4jb(final String boxID, final String modelName, final String pnlCnt, final String shtCnt,
			final String totalCnt, final String date, final String jsonAry) {
		ObjectMapper mapper = new ObjectMapper();
		String[] ja = null;
		try {
			ja = mapper.readValue(jsonAry, String[].class);
		} catch (Exception e) {
			System.out.println("Error took place");
			e.printStackTrace();
		}
		Label label = new Label(100, 80, 300);
		label.addText(new Text(8.8, 5.3, "Arial", 0, 13, "Model:  " + modelName));
		label.addText(new Text(56.2, 5.3, "Arial", 0, 13, "QTY:  " + shtCnt));
		label.addText(new Text(8.8, 9.3, "Arial", 0, 13, "Date:  " + date));
		label.addText(new Text(56.2, 9.3, "Arial", 0, 13, "Q'TY(S) :" + totalCnt));
		label.addText(new Text(56.2, 19.5, "Arial", 0, 13, "" + pnlCnt));
		label.addText(new Text(66, 19.5, "Arial ", 0, 13, "YIELD: 100%"));
		Text text = new Text(8.8, 13.7, "Arial Black", 0, 15, boxID);
		label.addText(text);
		Code code = new Code(8.8, 15, 7, 0.2, boxID);
		try {
			label.addCode(code);
		} catch (IOException e) {
			e.printStackTrace();
		}
		label.addText(new Text(8.8, 75.8, "Arial", 0, 11, "MADE IN CHINA"));
		label.addText(new Text(8.8, 78.5, "Arial", 0, 11, "BOE HF OPTOELECTRONICS TECHNOLOGY CO.,LTD"));
		if (ja == null) {
			System.out.println("Sheet array is empty");
		} else {
			double x1 = 9.8;
			double x2 = 52.2;
			double y = 25;
			double step = 2.5;
			for (int i = 0; i < ja.length; i++) {
				double x = 0;
				if (i % 2 == 0) {
					x = x1;
				} else {
					x = x2;
				}
				double _y = y + (i / 2) * step;
				label.addText(new Text(x, _y, "Arial", 0, 11, ja[i]));
			}
		}
		try {
			label.print();
		} catch (Exception e) {
			e.printStackTrace();
		}
		label.dispose();
	}

	public void PrintJX(final String customer_id, final String mode_id, final String date, final String prd_spec,
			final String wo_id, final String woCnt, final String jsonCntAry, final String boxRule, final String totalCnt,
			final String jsonAry, final String layout_cnt) {
		ObjectMapper mapper = new ObjectMapper();
		String[] ja = null;
		String[] jaCnt = null;
		int loopCnt;
		int li;
		int index;
		try {
			ja = mapper.readValue(jsonAry, String[].class);
		} catch (Exception e) {
			System.out.println("Error took place");
			e.printStackTrace();
		}
		try {
			jaCnt = mapper.readValue(jsonCntAry, String[].class);
		} catch (Exception e) {
			System.out.println("Error took place");
			e.printStackTrace();
		}
		System.out.println("Start");
		double len = ja.length;
		System.out.println(len);

		loopCnt = (int) Math.ceil(len / 12);
		System.out.println(Math.ceil(len / 12));
		System.out.println(len / 12);
		System.out.println(loopCnt);

		for (li = 0; li < loopCnt; li++) {
			LabelJX label = new LabelJX(212, 290, 300);
			int j = 0;
			int k = 0;
			int lj = 0;
			double step = 5;
			double _y = 6.5;
			double _yy = 12.9;
			double Max_y = 72.8;
			for (lj = 0; lj < 12; lj++) {
				index = li * 12 + lj;
				if (index >= ja.length) {
					break;
				}
				j = lj % 3;
				/**
				 * 横坐标值
				 */
				double x1 = 3.8 + 69 * j;
				double x2 = 24.3 + 69 * j;
				double x3 = 2 + 69 * j;
				double x4 = 23 + 69 * j;
				double x5 = 9.8 + 69 * j;
				double x6 = 29.8 + 69 * j;
				/**
				 * 纵坐标值
				 */
				k = lj / 3;
				double y1 = 8 + k * Max_y;
				double y2 = 6.8 + k * Max_y;
				double y3 = _y + Max_y * k + step;
				double y4 = _y + Max_y * k + 2 * step;
				double y5 = _y + Max_y * k + 3 * step;
				double y6 = _y + Max_y * k + 4 * step;
				double y7 = _y + Max_y * k + 5 * step;
				double y8 = _y + Max_y * k + 6 * step;
				double y9 = _y + Max_y * k + 7 * step;
				double yA = _y + Max_y * k + 8 * step;
				double yB = 3.3 + k * Max_y;
				double yD = 49 + k * Max_y;
				/**
				 * Line的纵坐标值
				 */
				double _yy1 = _yy + k * Max_y;
				double _yy2 = _yy + k * Max_y + step;
				double _yy3 = _yy + k * Max_y + 2 * step;
				double _yy4 = _yy + k * Max_y + 3 * step;
				double _yy5 = _yy + k * Max_y + 4 * step;
				double _yy6 = _yy + k * Max_y + 5 * step;
				double _yy7 = _yy + k * Max_y + 6 * step;
				double _yy8 = _yy + k * Max_y + 7 * step;

				label.addRectangle(new Rectangle(x3, y1, 67, 55.5, 0.2));
				label.addLine(new Line(x4, y1, 40, 0.2, -90));

				label.addText(new Text(x1, yB, "宋体", 2, 14, "WG•TECH"));
				label.addText(new Text(x5, y2, "宋体", 0, 10, "沃格光电"));
				label.addText(new Text(x6, y2, "宋体", 0, 14, "原料来料标签"));

				label.addText(new Text(x1, y3, "宋体", 0, 12, "客户代码"));
				label.addText(new Text(x2, y3, "Arial", 0, 12, customer_id));
				label.addLine(new Line(x3, _yy1, 67, 0.2, 0));

				label.addText(new Text(x1, y4, "宋体", 0, 12, "客户型号"));
				label.addText(new Text(x2, y4, "宋体", 0, 12, mode_id + "(" + layout_cnt + "模)"));
				label.addLine(new Line(x3, _yy2, 67, 0.2, 0));

				label.addText(new Text(x1, y5, "宋体", 0, 12, "来料日期"));
				label.addText(new Text(x2, y5, "Arial", 0, 12, date));
				label.addLine(new Line(x3, _yy3, 67, 0.2, 0));

				label.addText(new Text(x1, y6, "宋体", 0, 12, "规格"));
				label.addText(new Text(x2, y6, "Arial", 0, 12, prd_spec));
				label.addLine(new Line(x3, _yy4, 67, 0.2, 0));

				label.addText(new Text(x1, y7, "宋体", 0, 12, "生产订单号"));
				label.addText(new Text(x2, y7, "Arial", 0, 12, wo_id));
				label.addLine(new Line(x3, _yy5, 67, 0.2, 0));

				label.addText(new Text(x1, y8, "宋体", 0, 12, "订单数量"));
				label.addText(new Text(x2, y8, "Arial", 0, 12, woCnt));
				label.addLine(new Line(x3, _yy6, 67, 0.2, 0));

				label.addText(new Text(x1, y9, "宋体", 0, 12, "本箱数量"));
				label.addText(new Text(x2, y9, "Arial", 0, 12, jaCnt[index]));
				label.addLine(new Line(x3, _yy7, 67, 0.2, 0));

				label.addText(new Text(x1, yA, "宋体", 0, 12, "箱号"));
				label.addText(new Text(x2, yA, "Arial", 0, 12, (Integer.parseInt(boxRule) + index) + " / " + totalCnt));
				label.addLine(new Line(x3, _yy8, 67, 0.2, 0));

				Code code = new Code(x1, yD, 12, 0.30, ja[index]);
				try {
					label.addCode128(code);
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			try {
				label.print();
			} catch (Exception e) {
				e.printStackTrace();
			}
			label.dispose();
		}
	}

	public void PrintWG4PPBOX(final String customer_id, final String mode_id, final String date, final String prd_spec,
			final String wo_id, final String woCnt, final String jsonCntAry, final String jsonNumAry, final String totalCnt,
			final String jsonAry, final String layout_cnt, final String mtrl_id, final String habk_id, final String jsonDestAry) {
		ObjectMapper mapper = new ObjectMapper();
		String[] ja = null;
		String[] jaCnt = null;
		String[] jaDest = null;
		String[] jaNum = null;
		int loopCnt;
		int li;
		int index;
		try {
			ja = mapper.readValue(jsonAry, String[].class);
		} catch (Exception e) {
			System.out.println("Error took place");
			e.printStackTrace();
		}
		try {
			jaCnt = mapper.readValue(jsonCntAry, String[].class);
		} catch (Exception e) {
			System.out.println("Error took place");
			e.printStackTrace();
		}

		try {
			jaDest = mapper.readValue(jsonDestAry, String[].class);
		} catch (Exception e) {
			System.out.println("Error took place");
			e.printStackTrace();
		}

		try {
			jaNum = mapper.readValue(jsonNumAry, String[].class);
		} catch (Exception e) {
			System.out.println("Error took place");
			e.printStackTrace();
		}

		System.out.println("Start");
		double len = ja.length;
		System.out.println(len);

		loopCnt = (int) Math.ceil(len / 12);
		System.out.println(Math.ceil(len / 12));
		System.out.println(len / 12);
		System.out.println(loopCnt);

		for (li = 0; li < loopCnt; li++) {
			LabelJX label = new LabelJX(212, 290, 300);
			int j = 0;
			int k = 0;
			int lj = 0;
			double step = 5;
			double _y = 6.5;
			double _yy = 12.9;
			double Max_y = 72.8;
			for (lj = 0; lj < 12; lj++) {
				index = li * 12 + lj;
				if (index >= ja.length) {
					break;
				}
				j = lj % 3;
				/**
				 * 横坐标值
				 */
				double x1 = 3.8 + 69 * j;
				double x2 = 24.3 + 69 * j;
				double x3 = 2 + 69 * j;
				double x4 = 23 + 69 * j;
				double x5 = 9.8 + 69 * j;
				double x6 = 29.8 + 69 * j;
				/**
				 * 纵坐标值
				 */
				k = lj / 3;
				double y1 = 8 + k * Max_y;
				double y2 = 6.8 + k * Max_y;
				double y3 = _y + Max_y * k + step;
				double y4 = _y + Max_y * k + 2 * step;
				double y5 = _y + Max_y * k + 3 * step;
				double y6 = _y + Max_y * k + 4 * step;
				double y7 = _y + Max_y * k + 5 * step;
				double y8 = _y + Max_y * k + 6 * step;
				double y9 = _y + Max_y * k + 7 * step;
				double ya = _y + Max_y * k + 8 * step;
				double yb = _y + Max_y * k + 9 * step;
				double yA = _y + Max_y * k + 10 * step;
				double yB = 3.3 + k * Max_y;
				double yC = 59.1 + k * Max_y;
				double yD = 49 + k * Max_y;
				/**
				 * Line的纵坐标值
				 */
				double _yy1 = _yy + k * Max_y;
				double _yy2 = _yy + k * Max_y + step;
				double _yy3 = _yy + k * Max_y + 2 * step;
				double _yy4 = _yy + k * Max_y + 3 * step;
				double _yy5 = _yy + k * Max_y + 4 * step;
				double _yy6 = _yy + k * Max_y + 5 * step;
				double _yy7 = _yy + k * Max_y + 6 * step;
				double _yy8 = _yy + k * Max_y + 7 * step;
				double _yy9 = _yy + k * Max_y + 8 * step;
				double _yy0 = _yy + k * Max_y + 9 * step;

				if ("D".equals(jaDest[index])) {
					label.addRectangle(new Rectangle(x3, y1, 67, 64.2, 0.2));
					label.addLine(new Line(x4, y1, 50, 0.2, -90));
				} else {
					label.addRectangle(new Rectangle(x3, y1, 67, 53.5, 0.2));
					label.addLine(new Line(x4, y1, 40, 0.2, -90));
				}

				label.addText(new Text(x1, yB, "宋体", 2, 14, "WG•TECH"));
				label.addText(new Text(x5, y2, "宋体", 0, 10, "沃格光电"));
				label.addText(new Text(x6, y2, "宋体", 0, 14, "原料来料标签"));

				label.addText(new Text(x1, y3, "宋体", 0, 12, "客户代码"));
				label.addText(new Text(x2, y3, "Arial", 0, 12, customer_id));
				label.addLine(new Line(x3, _yy1, 67, 0.2, 0));

				label.addText(new Text(x1, y4, "宋体", 0, 12, "客户型号"));
				label.addText(new Text(x2, y4, "宋体", 0, 12, mode_id + "(" + layout_cnt + "模)"));
				label.addLine(new Line(x3, _yy2, 67, 0.2, 0));

				if ("D".equals(jaDest[index])) {
					label.addText(new Text(x1, y5, "宋体", 0, 12, "料号"));
					label.addText(new Text(x2, y5, "宋体", 0, 12, mtrl_id));
					label.addLine(new Line(x3, _yy3, 67, 0.2, 0));

					label.addText(new Text(x1, y6, "宋体", 0, 12, "手册号"));
					label.addText(new Text(x2, y6, "宋体", 0, 12, habk_id));
					label.addLine(new Line(x3, _yy4, 67, 0.2, 0));

					label.addText(new Text(x1, y7, "宋体", 0, 12, "来料日期"));
					label.addText(new Text(x2, y7, "Arial", 0, 12, date));
					label.addLine(new Line(x3, _yy5, 67, 0.2, 0));

					label.addText(new Text(x1, y8, "宋体", 0, 12, "规格"));
					label.addText(new Text(x2, y8, "Arial", 0, 12, prd_spec));
					label.addLine(new Line(x3, _yy6, 67, 0.2, 0));

					label.addText(new Text(x1, y9, "宋体", 0, 12, "生产订单号"));
					label.addText(new Text(x2, y9, "Arial", 0, 12, wo_id));
					label.addLine(new Line(x3, _yy7, 67, 0.2, 0));

					label.addText(new Text(x1, ya, "宋体", 0, 12, "订单数量"));
					label.addText(new Text(x2, ya, "Arial", 0, 12, woCnt));
					label.addLine(new Line(x3, _yy8, 67, 0.2, 0));

					label.addText(new Text(x1, yb, "宋体", 0, 12, "本箱数量"));
					label.addText(new Text(x2, yb, "Arial", 0, 12, jaCnt[index]));
					label.addLine(new Line(x3, _yy9, 67, 0.2, 0));

					label.addText(new Text(x1, yA, "宋体", 0, 12, "箱号"));
					label.addText(new Text(x2, yA, "Arial", 0, 12, jaNum[index] + " / " + totalCnt));
					label.addLine(new Line(x3, _yy0, 67, 0.2, 0));

					Code code = new Code(x1, yC, 12, 0.30, ja[index]);
					try {
						label.addCode128(code);
					} catch (IOException e) {
						e.printStackTrace();
					}
				} else {
					label.addText(new Text(x1, y5, "宋体", 0, 12, "来料日期"));
					label.addText(new Text(x2, y5, "Arial", 0, 12, date));
					label.addLine(new Line(x3, _yy3, 67, 0.2, 0));

					label.addText(new Text(x1, y6, "宋体", 0, 12, "规格"));
					label.addText(new Text(x2, y6, "Arial", 0, 12, prd_spec));
					label.addLine(new Line(x3, _yy4, 67, 0.2, 0));

					label.addText(new Text(x1, y7, "宋体", 0, 12, "生产订单号"));
					label.addText(new Text(x2, y7, "Arial", 0, 12, wo_id));
					label.addLine(new Line(x3, _yy5, 67, 0.2, 0));

					label.addText(new Text(x1, y8, "宋体", 0, 12, "订单数量"));
					label.addText(new Text(x2, y8, "Arial", 0, 12, woCnt));
					label.addLine(new Line(x3, _yy6, 67, 0.2, 0));

					label.addText(new Text(x1, y9, "宋体", 0, 12, "本箱数量"));
					label.addText(new Text(x2, y9, "Arial", 0, 12, jaCnt[index]));
					label.addLine(new Line(x3, _yy7, 67, 0.2, 0));

					label.addText(new Text(x1, ya, "宋体", 0, 12, "箱号"));
					label.addText(new Text(x2, ya, "Arial", 0, 12, jaNum[index] + " / " + totalCnt));
					label.addLine(new Line(x3, _yy8, 67, 0.2, 0));

					Code code = new Code(x1, yD, 12, 0.30, ja[index]);
					try {
						label.addCode128(code);
					} catch (IOException e) {
						e.printStackTrace();
					}
				}

			}
			try {
				label.print();
			} catch (Exception e) {
				e.printStackTrace();
			}
			label.dispose();
		}
	}

	public void PrintLabelForDM(final String printer, final String soId, final String cusId,
			final String compDate, final String overDueDate,
			final String mdl_id, final String toThickness,
			final String cusInfoFst, final String cusInfoSnd,
			final String prdQty, final String NgQty, final String boxId,
			final String prdGrade, final String userId,final String title) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
				
				ActiveXComponent axc = new ActiveXComponent("pt1.ct5");
		
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct5", printer, soId, cusId,
							compDate, overDueDate, mdl_id, toThickness, cusInfoFst,
							cusInfoSnd, prdQty, NgQty, boxId, prdGrade, userId,title);

				return null;
			}
		});
	}

	/**
	 * for 003客户出货信息表
	 * @param printer
	 * @param str
	 */
	public void PrintJBorDMQA003(final String printer ,final String str) {
		try {
			PrintQAFor003 printData = new PrintQAFor003();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			
			double stdQty = printData.getStdQty();
			String procId = printData.getProcId();
			String cusId = printData.getCusId();
			String woId = printData.getWoId();
			String boxId = printData.getBoxId();
			String shipBoxId = printData.getShipBoxId();
			String toThickness = printData.getToThickness();
			String prdCnt = printData.getPrdCnt();
			String modelCnt = printData.getModelCnt();
			String totalModelCnt = printData.getTotalModelCnt();
			String mdlId = printData.getMdlId();
			List<String> prdId = printData.getPrdAry();
			List<String> mtrlBox = printData.getMtrlBoxAry();
			List<String> r_yjyc_cnt = printData.getrYjycAry();
			List<String> r_llhx_cnt = printData.getrLlhxAry();
			List<String> r_atd_cnt = printData.getrAtdAry();
			List<String> r_pl_cnt = printData.getrPlAry();
			List<String> r_lh_cnt = printData.getrLhAry();
			List<String> r_qj_cnt = printData.getrQjAry();
			List<String> r_hs_cnt = printData.getrHsAry();
			List<String> r_bw_cnt = printData.getrBwAry();
			List<String> r_other = printData.getrOtherAry();
			List<String> r_cnt = printData.getrCntAry(); //未计算液晶异常
			List<String> c_pl_cnt = printData.getcPlAry();
			List<String> c_lh_cnt = printData.getcLhAry();
			List<String> c_qj_cnt = printData.getcQjAry();
			List<String> c_cj_cnt = printData.getcCjAry();
			List<String> c_ly_cnt = printData.getcLyAry();
			List<String> c_lsw_cnt = printData.getcLswAry();
			List<String> c_td_cnt = printData.getcTdAry();
			List<String> c_lhy_cnt = printData.getcLhyAry();
			List<String> c_ad_cnt = printData.getcAdAry();
			List<String> c_hs_cnt = printData.getcHsAry();
			List<String> c_bw_cnt = printData.getcBwAry();
			List<String> c_other = printData.getcOther();
			List<String> c_cnt = printData.getcCntAry();
			List<String> remark = printData.getRemarkAry();
			String printTyp = printData.getPrintTyp();
			String dateString = JackUtil.getCurTime();
			int loopCnt = (int) Math.ceil(stdQty / 34);
			String procTyp = "";
			if(procId.equals("JBQA")){
				procTyp = "JB";
			}else{
				procTyp = "DM";
			}
			Print excel = new Print(boxId,dateString,printTyp,"1",loopCnt,procTyp,cusId,woId);
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
			
			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
		        //读取了workbook内sheet内容  
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1))); 

				int totalrDef1 = 0;
				int totalrDef2 = 0;
				int totalrDef3 = 0;
				int totalrDef4 = 0;
				int totalrDef5 = 0;
				int totalrDef6 = 0;
				int totalrDef7 = 0;
				int totalrDef8 = 0;
				int totalrDef9 = 0;
				int totalrDef = 0;
				int totalcDef1 = 0;
				int totalcDef2 = 0;
				int totalcDef3 = 0;
				int totalcDef4 = 0;
				int totalcDef5 = 0;
				int totalcDef6 = 0;
				int totalcDef7 = 0;
				int totalcDef8 = 0;
				int totalcDef9 = 0;
				int totalcDef10 = 0;
				int totalcDef11 = 0;
				int totalcDef12 = 0;
				int totalcDef = 0;
				int OkCnt = 0;
				
				//第一行
		        HSSFCell cell = sheet.getRow(3).getCell(1);
		        cell.setCellValue(mdlId);
		        cell = sheet.getRow(3).getCell(8);
		        cell.setCellValue(shipBoxId);
		        cell = sheet.getRow(3).getCell(20);
		        cell.setCellValue(toThickness + "mm");
		        
	            //第二行
		        cell = sheet.getRow(4).getCell(1);
		        cell.setCellValue(Integer.parseInt(prdCnt, 10) + "sht");
		        cell = sheet.getRow(4).getCell(20);
		        cell.setCellValue(JackUtil.getCurDate());
		        
				for (j = 0; j < 34; j++, index++) {
					if (index <= stdQty) {
						cell = sheet.getRow(j+7).getCell(0);
				        cell.setCellValue(index);
				        
						if(!Util.isEmptyString(prdId.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(1);
					        cell.setCellValue(prdId.get(index - 1));
						}
						
						if(!Util.isEmptyString(mtrlBox.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(2);
					        cell.setCellValue(mtrlBox.get(index - 1));
						}

						if (!Util.isEmptyString(r_yjyc_cnt.get(index - 1)) && Integer.parseInt(r_yjyc_cnt.get(index - 1), 10) != 0) {
							totalrDef1 = totalrDef1 + Integer.parseInt(r_yjyc_cnt.get(index - 1), 10);
						}
						
						if (!Util.isEmptyString(r_llhx_cnt.get(index - 1)) && Integer.parseInt(r_llhx_cnt.get(index - 1), 10) != 0) {
							totalrDef2 = totalrDef2 + Integer.parseInt(r_llhx_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(4);
					        cell.setCellValue(Integer.parseInt(r_llhx_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(r_atd_cnt.get(index - 1)) && Integer.parseInt(r_atd_cnt.get(index - 1), 10) != 0) {
							totalrDef3 = totalrDef3 + Integer.parseInt(r_atd_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(5);
					        cell.setCellValue(Integer.parseInt(r_atd_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(r_pl_cnt.get(index - 1)) && Integer.parseInt(r_pl_cnt.get(index - 1), 10) != 0) {
							totalrDef4 = totalrDef4 + Integer.parseInt(r_pl_cnt.get(index - 1), 10);   
							cell = sheet.getRow(j+7).getCell(6);
					        cell.setCellValue(Integer.parseInt(r_pl_cnt.get(index - 1), 10));
						}  
				        
						if (!Util.isEmptyString(r_lh_cnt.get(index - 1)) && Integer.parseInt(r_lh_cnt.get(index - 1), 10) != 0) {
							totalrDef5 = totalrDef5 + Integer.parseInt(r_lh_cnt.get(index - 1), 10); 
							cell = sheet.getRow(j+7).getCell(7);
					        cell.setCellValue(Integer.parseInt(r_lh_cnt.get(index - 1), 10));
						}     
				        
						if (!Util.isEmptyString(r_qj_cnt.get(index - 1)) && Integer.parseInt(r_qj_cnt.get(index - 1), 10) != 0) {
							totalrDef6 = totalrDef6 + Integer.parseInt(r_qj_cnt.get(index - 1), 10);  
							cell = sheet.getRow(j+7).getCell(8);
					        cell.setCellValue(Integer.parseInt(r_qj_cnt.get(index - 1), 10));
						} 

						if (!Util.isEmptyString(r_hs_cnt.get(index - 1)) && Integer.parseInt(r_hs_cnt.get(index - 1), 10) != 0) {
							totalrDef7 = totalrDef7 + Integer.parseInt(r_hs_cnt.get(index - 1), 10);   
							cell = sheet.getRow(j+7).getCell(9);
					        cell.setCellValue(Integer.parseInt(r_hs_cnt.get(index - 1), 10));
						}

						if (!Util.isEmptyString(r_bw_cnt.get(index - 1)) && Integer.parseInt(r_bw_cnt.get(index - 1), 10) != 0) {
							totalrDef8 = totalrDef8 + Integer.parseInt(r_bw_cnt.get(index - 1), 10); 
							cell = sheet.getRow(j+7).getCell(10);
					        cell.setCellValue(Integer.parseInt(r_bw_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(r_other.get(index - 1)) && Integer.parseInt(r_other.get(index - 1), 10) != 0) {
							totalrDef9 = totalrDef9 + Integer.parseInt(r_other.get(index - 1), 10);  
							cell = sheet.getRow(j+7).getCell(11);
					        cell.setCellValue(Integer.parseInt(r_other.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(r_cnt.get(index - 1))) {
							totalrDef = totalrDef + Integer.parseInt(r_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(12);
					        cell.setCellValue(Integer.parseInt(r_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(c_pl_cnt.get(index - 1)) && Integer.parseInt(c_pl_cnt.get(index - 1), 10) != 0) {
							totalcDef1 = totalcDef1 + Integer.parseInt(c_pl_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(13);
					        cell.setCellValue(Integer.parseInt(c_pl_cnt.get(index - 1), 10));
						}

						if (!Util.isEmptyString(c_lh_cnt.get(index - 1)) && Integer.parseInt(c_lh_cnt.get(index - 1), 10) != 0) {
							totalcDef2 = totalcDef2 + Integer.parseInt(c_lh_cnt.get(index - 1), 10);     
							cell = sheet.getRow(j+7).getCell(14);
					        cell.setCellValue(Integer.parseInt(c_lh_cnt.get(index - 1), 10));
						} 
				        
						if (!Util.isEmptyString(c_qj_cnt.get(index - 1)) && Integer.parseInt(c_qj_cnt.get(index - 1), 10) != 0) {
							totalcDef3 = totalcDef3 + Integer.parseInt(c_qj_cnt.get(index - 1), 10);  
							cell = sheet.getRow(j+7).getCell(15);
					        cell.setCellValue(Integer.parseInt(c_qj_cnt.get(index - 1), 10));
						}

						if (!Util.isEmptyString(c_cj_cnt.get(index - 1)) && Integer.parseInt(c_cj_cnt.get(index - 1), 10) != 0) {
							totalcDef4 = totalcDef4 + Integer.parseInt(c_cj_cnt.get(index - 1), 10);   
							cell = sheet.getRow(j+7).getCell(16);
					        cell.setCellValue(Integer.parseInt(c_cj_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(c_ly_cnt.get(index - 1)) && Integer.parseInt(c_ly_cnt.get(index - 1), 10) != 0) {
							totalcDef5 = totalcDef5 + Integer.parseInt(c_ly_cnt.get(index - 1), 10);  
							cell = sheet.getRow(j+7).getCell(17);
					        cell.setCellValue(Integer.parseInt(c_ly_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(c_lsw_cnt.get(index - 1)) && Integer.parseInt(c_lsw_cnt.get(index - 1), 10) != 0) {
							totalcDef6 = totalcDef6 + Integer.parseInt(c_lsw_cnt.get(index - 1), 10);   
							cell = sheet.getRow(j+7).getCell(18);
					        cell.setCellValue(Integer.parseInt(c_lsw_cnt.get(index - 1), 10));
						}                                                                             
				        
						if (!Util.isEmptyString(c_td_cnt.get(index - 1)) && Integer.parseInt(c_td_cnt.get(index - 1), 10) != 0) {
							totalcDef7 = totalcDef7 + Integer.parseInt(c_td_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(19);
					        cell.setCellValue(Integer.parseInt(c_td_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(c_lhy_cnt.get(index - 1)) && Integer.parseInt(c_lhy_cnt.get(index - 1), 10) != 0) {
							totalcDef8 = totalcDef8 + Integer.parseInt(c_lhy_cnt.get(index - 1), 10);   
							cell = sheet.getRow(j+7).getCell(20);
					        cell.setCellValue(Integer.parseInt(c_lhy_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(c_ad_cnt.get(index - 1)) && Integer.parseInt(c_ad_cnt.get(index - 1), 10) != 0) {
							totalcDef9 = totalcDef9 + Integer.parseInt(c_ad_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(21);
					        cell.setCellValue(Integer.parseInt(c_ad_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(c_hs_cnt.get(index - 1)) && Integer.parseInt(c_hs_cnt.get(index - 1), 10) != 0) {
							totalcDef10 = totalcDef10 + Integer.parseInt(c_hs_cnt.get(index - 1), 10); 
							cell = sheet.getRow(j+7).getCell(22);
					        cell.setCellValue(Integer.parseInt(c_hs_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(c_bw_cnt.get(index - 1)) && Integer.parseInt(c_bw_cnt.get(index - 1), 10) != 0) {
							totalcDef11 = totalcDef11 + Integer.parseInt(c_bw_cnt.get(index - 1), 10);  
							cell = sheet.getRow(j+7).getCell(23);
					        cell.setCellValue(Integer.parseInt(c_bw_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(c_other.get(index - 1)) && Integer.parseInt(c_other.get(index - 1), 10) != 0) {
							totalcDef12 = totalcDef12 + Integer.parseInt(c_other.get(index - 1), 10);  
							cell = sheet.getRow(j+7).getCell(24);
					        cell.setCellValue(Integer.parseInt(c_other.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(c_cnt.get(index - 1))) {
							totalcDef = totalcDef + Integer.parseInt(c_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(25);
					        cell.setCellValue(Integer.parseInt(c_cnt.get(index - 1), 10));
						}
						
						if(!Util.isEmptyString(remark.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(26);
					        cell.setCellValue(remark.get(index - 1));
						}
					}
				}
				OkCnt = Integer.parseInt(totalModelCnt) - totalrDef - totalcDef;
		        cell = sheet.getRow(4).getCell(8);
		        cell.setCellValue(OkCnt + "/" + totalModelCnt);
				cell = sheet.getRow(41).getCell(3);
		        cell.setCellValue(0);
		        cell = sheet.getRow(41).getCell(4);
		        cell.setCellValue(totalrDef2);
		        cell = sheet.getRow(41).getCell(5);
		        cell.setCellValue(totalrDef3);
		        cell = sheet.getRow(41).getCell(6);
		        cell.setCellValue(totalrDef4);
		        cell = sheet.getRow(41).getCell(7);
		        cell.setCellValue(totalrDef5);
		        cell = sheet.getRow(41).getCell(8);
		        cell.setCellValue(totalrDef6);
		        cell = sheet.getRow(41).getCell(9);
		        cell.setCellValue(totalrDef7);
		        cell = sheet.getRow(41).getCell(10);
		        cell.setCellValue(totalrDef8);
		        cell = sheet.getRow(41).getCell(11);
		        cell.setCellValue(totalrDef9);
		        cell = sheet.getRow(41).getCell(12);
		        cell.setCellValue(totalrDef);
		        cell = sheet.getRow(41).getCell(13);
		        cell.setCellValue(totalcDef1);
		        cell = sheet.getRow(41).getCell(14);
		        cell.setCellValue(totalcDef2);
		        cell = sheet.getRow(41).getCell(15);
		        cell.setCellValue(totalcDef3);
		        cell = sheet.getRow(41).getCell(16);
		        cell.setCellValue(totalcDef4);
		        cell = sheet.getRow(41).getCell(17);
		        cell.setCellValue(totalcDef5);
		        cell = sheet.getRow(41).getCell(18);
		        cell.setCellValue(totalcDef6);
		        cell = sheet.getRow(41).getCell(19);
		        cell.setCellValue(totalcDef7);
		        cell = sheet.getRow(41).getCell(20);
		        cell.setCellValue(totalcDef8);
		        cell = sheet.getRow(41).getCell(21);
		        cell.setCellValue(totalcDef9);
		        cell = sheet.getRow(41).getCell(22);
		        cell.setCellValue(totalcDef10);
		        cell = sheet.getRow(41).getCell(23);
		        cell.setCellValue(totalcDef11);
		        cell = sheet.getRow(41).getCell(24);
		        cell.setCellValue(totalcDef12);
		        cell = sheet.getRow(41).getCell(25);
		        cell.setCellValue(totalcDef);
		        cell = sheet.getRow(41).getCell(26);
		        cell.setCellValue("订单号：" + woId);
			}
			String filename = excel.creatFile();
			FileOutputStream fileOut = new FileOutputStream(filename);  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
	        excel.printExcel(printer,filename);
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}
	
	/**
	 * for 006客户 for JBQA
	 * @param printer
	 * @param str
	 */
	public void PrintJBQA006(final String printer ,final String str) {
		try {
			PrintQAFor006 printData = new PrintQAFor006();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			
			double stdQty = printData.getStdQty();
			String procId = printData.getProcId();
			String cusId = printData.getCusId();
			String woId = printData.getWoId();
			String actSoId = printData.getActSoId();
			String boxId = printData.getBoxId();
			String toThickness = printData.getToThickness();
			String prdCnt = printData.getPrdCnt();
			String modelCnt = printData.getModelCnt();
			String totalModelCnt = printData.getTotalModelCnt();
			String mdlId = printData.getMdlId();
			List<String> prdId = printData.getPrdAry();
			List<String> mtrlBox = printData.getMtrlBoxAry();
			List<String> C_z_pl_cnt = printData.getCzPlAry();
			List<String> C_z_ly_cnt = printData.getCzLyAry();
			List<String> C_z_zw_cnt = printData.getCzZwAry();
			List<String> C_z_skbj_cnt = printData.getCzSkbjAry();
			List<String> C_z_atd_cnt = printData.getCzAtdAry();
			List<String> C_z_hs_cnt = printData.getCzHsAry();
			List<String> C_l_pl_cnt = printData.getClPlAry();
			List<String> C_l_yjyc_cnt = printData.getClYjycAry();
			List<String> C_l_ad_cnt = printData.getClAdAry();
			List<String> C_l_mjad_cnt = printData.getClMjadAry();
			List<String> C_l_hs_cnt = printData.getClHsAry();
			List<String> C_l_gly_cnt = printData.getClGlyAry();
			List<String> T_z_zw_cnt = printData.getTzZwAry();
			List<String> T_z_skbj_cnt = printData.getTzSkbjAry();
			List<String> T_z_atd_cnt = printData.getTzAtdAry();
			List<String> T_z_hs_cnt = printData.getTzHsAry();
			List<String> T_l_ad_cnt = printData.getTlAdAry();
			List<String> T_l_mjad_cnt = printData.getTlMjadAry();
			List<String> T_l_hs_cnt = printData.getTlHsAry();
			List<String> T_l_gly_cnt = printData.getTlGlyAry();
			List<String> total_Def = printData.getTotalAry();
			List<String> status = printData.getStatusAry();
			List<String> remark = printData.getRemarkAry();
			String printTyp = printData.getPrintTyp();
			String dateString = JackUtil.getCurTime();
			int loopCnt = (int) Math.ceil(stdQty / 30);
			
			String procTyp = "";
			if(procId.equals("JBQA")){
				procTyp = "JB";
			}else{
				procTyp = "DM";
			}
			
			Print excel = new Print(boxId,dateString,printTyp,"9",loopCnt,procTyp,cusId,woId);
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
			
			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
		        //读取了workbook内sheet内容  
		        HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1))); 
		        
				int totalDef1 = 0;
				int totalDef2 = 0;
				int totalDef3 = 0;
				int totalDef4 = 0;
				int totalDef5 = 0;
				int totalDef6 = 0;
				int totalDef7 = 0;
				int totalDef8 = 0;
				int totalDef9 = 0; 
				int totalDef10 = 0;
				int totalDef11 = 0;
				int totalDef12 = 0;
				int totalDef13 = 0;
				int totalDef14 = 0;
				int totalDef15 = 0;
				int totalDef16 = 0;
				int totalDef17 = 0;
				int totalDef18 = 0;
				int totalDef19 = 0;
				int totalDef20 = 0; 
				int totalDef = 0;

				//第一行
		        HSSFCell cell = sheet.getRow(3).getCell(1);
		        cell.setCellValue(cusId);
		        cell = sheet.getRow(3).getCell(5);
		        cell.setCellValue(actSoId);
		        cell = sheet.getRow(3).getCell(13);
		        cell.setCellValue(boxId);
		        cell = sheet.getRow(3).getCell(20);
		        cell.setCellValue(toThickness + "mm");
			    cell = sheet.getRow(3).getCell(24);
		        cell.setCellValue(mdlId);

	            //第二行
		        cell = sheet.getRow(4).getCell(1);
		        cell.setCellValue(Integer.parseInt(prdCnt, 10));
		        cell = sheet.getRow(4).getCell(5);
		        cell.setCellValue(JackUtil.getCurDate());
		        cell = sheet.getRow(4).getCell(20);
		        cell.setCellValue(Integer.parseInt(modelCnt, 10));
			    cell = sheet.getRow(4).getCell(24);
		        cell.setCellValue(woId);
		        
				for (j = 0; j < 30; j++, index++) {
					if (index <= stdQty) {
						cell = sheet.getRow(j+7).getCell(0);
				        cell.setCellValue(index);
				        
						if(!Util.isEmptyString(prdId.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(1);
					        cell.setCellValue(prdId.get(index - 1));
						}
						
						if(!Util.isEmptyString(mtrlBox.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(2);
					        cell.setCellValue(mtrlBox.get(index - 1));
						}
						
						if(!Util.isEmptyString(status.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(3);
					        cell.setCellValue(status.get(index - 1));
						}
						
						if (!Util.isEmptyString(C_z_pl_cnt.get(index - 1)) && Integer.parseInt(C_z_pl_cnt.get(index - 1), 10) != 0) {
							totalDef1 = totalDef1 + Integer.parseInt(C_z_pl_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(4);
					        cell.setCellValue(Integer.parseInt(C_z_pl_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_z_ly_cnt.get(index - 1)) && Integer.parseInt(C_z_ly_cnt.get(index - 1), 10) != 0) {
							totalDef2 = totalDef2 + Integer.parseInt(C_z_ly_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(5);
					        cell.setCellValue(Integer.parseInt(C_z_ly_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_z_zw_cnt.get(index - 1)) && Integer.parseInt(C_z_zw_cnt.get(index - 1), 10) != 0) {
							totalDef3 = totalDef3 + Integer.parseInt(C_z_zw_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(6);
					        cell.setCellValue(Integer.parseInt(C_z_zw_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_z_skbj_cnt.get(index - 1)) && Integer.parseInt(C_z_skbj_cnt.get(index - 1), 10) != 0) {
							totalDef4 = totalDef4 + Integer.parseInt(C_z_skbj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(7);
					        cell.setCellValue(Integer.parseInt(C_z_skbj_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_z_atd_cnt.get(index - 1)) && Integer.parseInt(C_z_atd_cnt.get(index - 1), 10) != 0) {
							totalDef5 = totalDef5 + Integer.parseInt(C_z_atd_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(8);
					        cell.setCellValue(Integer.parseInt(C_z_atd_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_z_hs_cnt.get(index - 1)) && Integer.parseInt(C_z_hs_cnt.get(index - 1), 10) != 0) {
							totalDef6 = totalDef6 + Integer.parseInt(C_z_hs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(9);
					        cell.setCellValue(Integer.parseInt(C_z_hs_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_l_pl_cnt.get(index - 1)) && Integer.parseInt(C_l_pl_cnt.get(index - 1), 10) != 0) {
							totalDef7 = totalDef7 + Integer.parseInt(C_l_pl_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(10);
					        cell.setCellValue(Integer.parseInt(C_l_pl_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_l_yjyc_cnt.get(index - 1)) && Integer.parseInt(C_l_yjyc_cnt.get(index - 1), 10) != 0) {
							totalDef8 = totalDef8 + Integer.parseInt(C_l_yjyc_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(11);
					        cell.setCellValue(Integer.parseInt(C_l_yjyc_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_l_ad_cnt.get(index - 1)) && Integer.parseInt(C_l_ad_cnt.get(index - 1), 10) != 0) {
							totalDef9 = totalDef9 + Integer.parseInt(C_l_ad_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(12);
					        cell.setCellValue(Integer.parseInt(C_l_ad_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_l_mjad_cnt.get(index - 1)) && Integer.parseInt(C_l_mjad_cnt.get(index - 1), 10) != 0) {
							totalDef10 = totalDef10 + Integer.parseInt(C_l_mjad_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(13);
					        cell.setCellValue(Integer.parseInt(C_l_mjad_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_l_hs_cnt.get(index - 1)) && Integer.parseInt(C_l_hs_cnt.get(index - 1), 10) != 0) {
							totalDef11 = totalDef11 + Integer.parseInt(C_l_hs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(14);
					        cell.setCellValue(Integer.parseInt(C_l_hs_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_l_gly_cnt.get(index - 1)) && Integer.parseInt(C_l_gly_cnt.get(index - 1), 10) != 0) {
							totalDef12 = totalDef12 + Integer.parseInt(C_l_gly_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(15);
					        cell.setCellValue(Integer.parseInt(C_l_gly_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(T_z_zw_cnt.get(index - 1)) && Integer.parseInt(T_z_zw_cnt.get(index - 1), 10) != 0) {
							totalDef13 = totalDef13 + Integer.parseInt(T_z_zw_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(16);
					        cell.setCellValue(Integer.parseInt(T_z_zw_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(T_z_skbj_cnt.get(index - 1)) && Integer.parseInt(T_z_skbj_cnt.get(index - 1), 10) != 0) {
							totalDef14 = totalDef14 + Integer.parseInt(T_z_skbj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(17);
					        cell.setCellValue(Integer.parseInt(T_z_skbj_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(T_z_atd_cnt.get(index - 1)) && Integer.parseInt(T_z_atd_cnt.get(index - 1), 10) != 0) {
							totalDef15 = totalDef15 + Integer.parseInt(T_z_atd_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(18);
					        cell.setCellValue(Integer.parseInt(T_z_atd_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(T_z_hs_cnt.get(index - 1)) && Integer.parseInt(T_z_hs_cnt.get(index - 1), 10) != 0) {
							totalDef16 = totalDef16 + Integer.parseInt(T_z_hs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(19);
					        cell.setCellValue(Integer.parseInt(T_z_hs_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(T_l_ad_cnt.get(index - 1)) && Integer.parseInt(T_l_ad_cnt.get(index - 1), 10) != 0) {
							totalDef17 = totalDef17 + Integer.parseInt(T_l_ad_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(20);
					        cell.setCellValue(Integer.parseInt(T_l_ad_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(T_l_mjad_cnt.get(index - 1)) && Integer.parseInt(T_l_mjad_cnt.get(index - 1), 10) != 0) {
							totalDef18 = totalDef18 + Integer.parseInt(T_l_mjad_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(21);
					        cell.setCellValue(Integer.parseInt(T_l_mjad_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(T_l_hs_cnt.get(index - 1)) && Integer.parseInt(T_l_hs_cnt.get(index - 1), 10) != 0) {
							totalDef19 = totalDef19 + Integer.parseInt(T_l_hs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(22);
					        cell.setCellValue(Integer.parseInt(T_l_hs_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(T_l_gly_cnt.get(index - 1)) && Integer.parseInt(T_l_gly_cnt.get(index - 1), 10) != 0) {
							totalDef20 = totalDef20 + Integer.parseInt(T_l_gly_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(23);
					        cell.setCellValue(Integer.parseInt(T_l_gly_cnt.get(index - 1), 10));
						}
						
						if(!Util.isEmptyString(total_Def.get(index - 1))){
							totalDef = totalDef + Integer.parseInt(total_Def.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(24);
					        cell.setCellValue(Integer.parseInt(total_Def.get(index - 1), 10));
						}
						
						if(!Util.isEmptyString(remark.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(25);
					        cell.setCellValue(remark.get(index - 1));
						}
					}
				}

		        cell = sheet.getRow(37).getCell(4);
		        cell.setCellValue(totalDef1);
		        cell = sheet.getRow(37).getCell(5);
		        cell.setCellValue(totalDef2);
		        cell = sheet.getRow(37).getCell(6);
		        cell.setCellValue(totalDef3);
		        cell = sheet.getRow(37).getCell(7);
		        cell.setCellValue(totalDef4);
		        cell = sheet.getRow(37).getCell(8);
		        cell.setCellValue(totalDef5);
		        cell = sheet.getRow(37).getCell(9);
		        cell.setCellValue(totalDef6);
		        cell = sheet.getRow(37).getCell(10);
		        cell.setCellValue(totalDef7);
		        cell = sheet.getRow(37).getCell(11);
		        cell.setCellValue(totalDef8);
		        cell = sheet.getRow(37).getCell(12);
		        cell.setCellValue(totalDef9);
		        cell = sheet.getRow(37).getCell(13);
		        cell.setCellValue(totalDef10);
		        cell = sheet.getRow(37).getCell(14);
		        cell.setCellValue(totalDef11);
		        cell = sheet.getRow(37).getCell(15);
		        cell.setCellValue(totalDef12);
		        cell = sheet.getRow(37).getCell(16);
		        cell.setCellValue(totalDef13);
		        cell = sheet.getRow(37).getCell(17);
		        cell.setCellValue(totalDef14);
		        cell = sheet.getRow(37).getCell(18);
		        cell.setCellValue(totalDef15);
		        cell = sheet.getRow(37).getCell(19);
		        cell.setCellValue(totalDef16);
		        cell = sheet.getRow(37).getCell(20);
		        cell.setCellValue(totalDef17);
		        cell = sheet.getRow(37).getCell(21);
		        cell.setCellValue(totalDef18);
		        cell = sheet.getRow(37).getCell(22);
		        cell.setCellValue(totalDef19);
		        cell = sheet.getRow(37).getCell(23);
		        cell.setCellValue(totalDef20);
		        cell = sheet.getRow(37).getCell(24);
		        cell.setCellValue(totalDef);
			}
			String filename = excel.creatFile();
			FileOutputStream fileOut = new FileOutputStream(filename);  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
	        excel.printExcel(printer,filename);
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}
	
	/**
	 * 008 HSD 客户出货信息表
	 */
	public void PrintJBorDMQA008(final String printer,final String str){
		try {
			PrintQAFor008 printData = new PrintQAFor008();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			
			double stdQty = printData.getStdQty();
			String procId = printData.getProcId();
			String cusId = printData.getCusId();
			String woId = printData.getWoId();
			String soId = printData.getSoId();
			String boxId = printData.getBoxId();
			String cusInfoFst = printData.getCusInfoFst();
			String modelCnt = printData.getModelCnt();
			String totalModelCnt = printData.getTotalModelCnt();
			String prdCnt = printData.getPrdCnt();
			String mdlId = printData.getMdlId();
			List<String> prdId = printData.getPrdAry();
			List<String> l_ly_cnt = printData.getlLyAry();              
			List<String> l_llxo_cnt = printData.getlLlxoAry();      
			List<String> l_hnbl_cnt = printData.getlHnblAry();
			List<String> l_pl_cnt = printData.getlPlAry();
			List<String> z_c_skbj_cnt = printData.getZcSkbjAry();   
			List<String> z_c_dqx_cnt = printData.getZcDqxAry();
			List<String> z_c_xqx_cnt = printData.getZcXqxAry();   
			List<String> z_c_wj_cnt = printData.getZcWjAry();      
			List<String> z_t_skbj_cnt = printData.getZtSkbjAry();
			List<String> z_t_dqx_cnt = printData.getZtDqxAry();
			List<String> z_t_xqx_cnt = printData.getZtXqxAry();
			List<String> z_t_wj_cnt = printData.getZtWjAry();
			List<String> z_t_pit_cnt = printData.getZtPitAry();
			List<String> jbpl_cnt = printData.getJbPlAry();
			List<String> jbly_cnt = printData.getJbLyAry();  
			List<String> status = printData.getStatusAry();
			List<String> remark = printData.getRemarkAry();
			String printTyp = printData.getPrintTyp();
			String dateString = JackUtil.getCurTime();
			int loopCnt = (int) Math.ceil(stdQty / 40);
			
			String procTyp = "";
			if(procId.equals("JBQA")){
				procTyp = "JB";
			}else{
				procTyp = "DM";
			}
			
			Print excel = new Print(boxId,dateString,printTyp,"4",loopCnt,procTyp,cusId,woId);
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
			
			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
		        //读取了workbook内sheet内容  
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1))); 
				
				int totalDef1 = 0;
				int totalDef2 = 0;
				int totalDef3 = 0;
				int totalDef4 = 0;
				int totalDef5 = 0;
				int totalDef6 = 0;
				int totalDef7 = 0;
				int totalDef8 = 0;
				int totalDef9 = 0; 
				int totalDef10 = 0;
				int totalDef11 = 0;
				int totalDef12 = 0;
				int totalDef13 = 0;
				int totalDef14 = 0;
				int totalDef15 = 0;

				//第一行
		        HSSFCell cell = sheet.getRow(3).getCell(1);
		        cell.setCellValue(cusId);
		        cell = sheet.getRow(3).getCell(4);
		        cell.setCellValue(soId);
		        cell = sheet.getRow(3).getCell(10);
		        cell.setCellValue(boxId);
		        cell = sheet.getRow(3).getCell(16);
		        cell.setCellValue(modelCnt);
		        
	            //第二行
		        cell = sheet.getRow(4).getCell(1);
		        cell.setCellValue(mdlId);
		        cell = sheet.getRow(4).getCell(10);
		        cell.setCellValue(cusInfoFst);
		        
		        cell = sheet.getRow(5).getCell(19);
		        cell.setCellValue("QTY：" + prdCnt + "/" + totalModelCnt);
				
				for (j = 0; j < 40; j++, index++) {
					if (index <= stdQty) {
						cell = sheet.getRow(j+8).getCell(0);
				        cell.setCellValue(index);
				        
						if(!Util.isEmptyString(prdId.get(index - 1))){
							cell = sheet.getRow(j+8).getCell(1);
					        cell.setCellValue(prdId.get(index - 1));
						}
						
						if(!Util.isEmptyString(status.get(index - 1))){
							cell = sheet.getRow(j+8).getCell(2);
					        cell.setCellValue(status.get(index - 1));
						}
						
						if (!Util.isEmptyString(l_ly_cnt.get(index - 1)) && Integer.parseInt(l_ly_cnt.get(index - 1), 10) != 0) {
							totalDef1 = totalDef1 + Integer.parseInt(l_ly_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(3);
					        cell.setCellValue(Integer.parseInt(l_ly_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_llxo_cnt.get(index - 1)) && Integer.parseInt(l_llxo_cnt.get(index - 1), 10) != 0) {
							totalDef2 = totalDef2 + Integer.parseInt(l_llxo_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(4);
					        cell.setCellValue(Integer.parseInt(l_llxo_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_hnbl_cnt.get(index - 1)) && Integer.parseInt(l_hnbl_cnt.get(index - 1), 10) != 0) {
							totalDef3 = totalDef3 + Integer.parseInt(l_hnbl_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(5);
					        cell.setCellValue(Integer.parseInt(l_hnbl_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_pl_cnt.get(index - 1)) && Integer.parseInt(l_pl_cnt.get(index - 1), 10) != 0) {
							totalDef4 = totalDef4 + Integer.parseInt(l_pl_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(6);
					        cell.setCellValue(Integer.parseInt(l_pl_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_c_skbj_cnt.get(index - 1)) && Integer.parseInt(z_c_skbj_cnt.get(index - 1), 10) != 0) {
							totalDef5 = totalDef5 + Integer.parseInt(z_c_skbj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(7);
					        cell.setCellValue(Integer.parseInt(z_c_skbj_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_c_dqx_cnt.get(index - 1)) && Integer.parseInt(z_c_dqx_cnt.get(index - 1), 10) != 0) {
							totalDef6 = totalDef6 + Integer.parseInt(z_c_dqx_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(8);
					        cell.setCellValue(Integer.parseInt(z_c_dqx_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_c_xqx_cnt.get(index - 1)) && Integer.parseInt(z_c_xqx_cnt.get(index - 1), 10) != 0) {
							totalDef7 = totalDef7 + Integer.parseInt(z_c_xqx_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(9);
					        cell.setCellValue(Integer.parseInt(z_c_xqx_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_c_wj_cnt.get(index - 1)) && Integer.parseInt(z_c_wj_cnt.get(index - 1), 10) != 0) {
							totalDef8 = totalDef8 + Integer.parseInt(z_c_wj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(10);
					        cell.setCellValue(Integer.parseInt(z_c_wj_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_t_skbj_cnt.get(index - 1)) && Integer.parseInt(z_t_skbj_cnt.get(index - 1), 10) != 0) {
							totalDef9 = totalDef9 + Integer.parseInt(z_t_skbj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(11);
					        cell.setCellValue(Integer.parseInt(z_t_skbj_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_t_dqx_cnt.get(index - 1)) && Integer.parseInt(z_t_dqx_cnt.get(index - 1), 10) != 0) {
							totalDef10 = totalDef10 + Integer.parseInt(z_t_dqx_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(12);
					        cell.setCellValue(Integer.parseInt(z_t_dqx_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_t_xqx_cnt.get(index - 1)) && Integer.parseInt(z_t_xqx_cnt.get(index - 1), 10) != 0) {
							totalDef11 = totalDef11 + Integer.parseInt(z_t_xqx_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(13);
					        cell.setCellValue(Integer.parseInt(z_t_xqx_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_t_wj_cnt.get(index - 1)) && Integer.parseInt(z_t_wj_cnt.get(index - 1), 10) != 0) {
							totalDef12 = totalDef12 + Integer.parseInt(z_t_wj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(14);
					        cell.setCellValue(Integer.parseInt(z_t_wj_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_t_pit_cnt.get(index - 1)) && Integer.parseInt(z_t_pit_cnt.get(index - 1), 10) != 0) {
							totalDef13 = totalDef13 + Integer.parseInt(z_t_pit_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(15);
					        cell.setCellValue(Integer.parseInt(z_t_pit_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(jbpl_cnt.get(index - 1)) && Integer.parseInt(jbpl_cnt.get(index - 1), 10) != 0) {
							totalDef14 = totalDef14 + Integer.parseInt(jbpl_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(16);
					        cell.setCellValue(Integer.parseInt(jbpl_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(jbly_cnt.get(index - 1)) && Integer.parseInt(jbly_cnt.get(index - 1), 10) != 0) {
							totalDef15 = totalDef15 + Integer.parseInt(jbly_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(17);
					        cell.setCellValue(Integer.parseInt(jbly_cnt.get(index - 1), 10));
						}
						
						if(!Util.isEmptyString(remark.get(index - 1))){
							cell = sheet.getRow(j+8).getCell(19);
					        cell.setCellValue(remark.get(index - 1));
						}
					}
				}
				
				cell = sheet.getRow(48).getCell(3);
		        cell.setCellValue(totalDef1);
		        cell = sheet.getRow(48).getCell(4);
		        cell.setCellValue(totalDef2);
		        cell = sheet.getRow(48).getCell(5);
		        cell.setCellValue(totalDef3);
		        cell = sheet.getRow(48).getCell(6);
		        cell.setCellValue(totalDef4);
		        cell = sheet.getRow(48).getCell(7);
		        cell.setCellValue(totalDef5);
		        cell = sheet.getRow(48).getCell(8);
		        cell.setCellValue(totalDef6);
		        cell = sheet.getRow(48).getCell(9);
		        cell.setCellValue(totalDef7);
		        cell = sheet.getRow(48).getCell(10);
		        cell.setCellValue(totalDef8);
		        cell = sheet.getRow(48).getCell(11);
		        cell.setCellValue(totalDef9);
		        cell = sheet.getRow(48).getCell(12);
		        cell.setCellValue(totalDef10);
		        cell = sheet.getRow(48).getCell(13);
		        cell.setCellValue(totalDef11);
		        cell = sheet.getRow(48).getCell(14);
		        cell.setCellValue(totalDef12);
		        cell = sheet.getRow(48).getCell(15);
		        cell.setCellValue(totalDef13);
		        cell = sheet.getRow(48).getCell(16);
		        cell.setCellValue(totalDef14);
		        cell = sheet.getRow(48).getCell(17);
		        cell.setCellValue(totalDef15);
				
		        cell = sheet.getRow(49).getCell(0);
		        cell.setCellValue("内部订单号：" + woId);
		        
				String filename = excel.creatFile();
				FileOutputStream fileOut = new FileOutputStream(filename);  
				workbook.write(fileOut); 
				fileOut.flush();
				fileOut.close(); 
		        excel.printExcel(printer,filename);
			}
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}
	
	/**
	 * for 013 TCL客户出货信息表
	 * @param printer
	 * @param str
	 */
	public void PrintJBorDMQA013(final String printer ,final String str) {
		try {
			PrintQAFor013 printData = new PrintQAFor013();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			
			double stdQty = printData.getStdQty();
			String procId = printData.getProcId();
			String cusId = printData.getCusId();
			String woId = printData.getWoId();
			String actSoId = printData.getActSoId();
			String boxId = printData.getBoxId();
			String prdCnt = printData.getPrdCnt();
			String toThickness = printData.getToThickness();
			String totalModelCnt = printData.getTotalModelCnt();
			String modelCnt = printData.getModelCnt();
			String mdlId = printData.getMdlId();
			String whole_def_cnt = printData.getWhole_def_cnt();
			String whole_yield = printData.getWhole_yield();
			List<String> prdId = printData.getPrdAry();
			List<String> l_hnbl_cnt = printData.getlHnblAry();
			List<String> l_llhx_cnt = printData.getlLlhxAry();
			List<String> l_atd_cnt = printData.getlAtdAry();
			List<String> l_ps_cnt = printData.getlPsAry();
			List<String> l_lw_cnt = printData.getlLwAry();
			List<String> l_hs_cnt = printData.getlHsAry();
			List<String> l_zw_cnt = printData.getlZwAry();
			List<String> l_ly_cnt = printData.getlLyAry();
			List<String> l_other = printData.getlOther();
			List<String> z_d_atd_cnt = printData.getZdAtdAry();
			List<String> z_d_hs_cnt = printData.getZdHsAry();
			List<String> z_d_ssbj_cnt = printData.getZdSsbjAry();
			List<String> z_d_zw_cnt = printData.getZdZwAry();
			List<String> z_ps_cnt = printData.getzPsAry();
			List<String> z_lw_cnt = printData.getzLwAry();
			List<String> z_ly_cnt = printData.getzLyAry();
			List<String> z_ls_cnt = printData.getzLsAry();
			List<String> z_fs_cnt = printData.getzFsAry();
			List<String> z_other = printData.getzOther();
			List<String> status = printData.getStatusAry();
			List<String> remark = printData.getRemarkAry();
			String checkUser = printData.getCheckUser();
			String printTyp = printData.getPrintTyp();
			String dateString = JackUtil.getCurTime();
			int loopCnt = (int) Math.ceil(stdQty / 25);
			
			String procTyp = "";
			if(procId.equals("JBQA")){
				procTyp = "JB";
			}else{
				procTyp = "DM";
			}
			
			Print excel = new Print(boxId,dateString,printTyp,"D",loopCnt,procTyp,cusId,woId);
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
			
			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
		        //读取了workbook内sheet内容  
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1))); 

				//第一行
		        HSSFCell cell = sheet.getRow(3).getCell(1);
		        cell.setCellValue(cusId);
		        cell = sheet.getRow(3).getCell(3);
		        cell.setCellValue(toThickness + "mm");
		        cell = sheet.getRow(3).getCell(9);
		        cell.setCellValue(boxId);
		        cell = sheet.getRow(3).getCell(14);
		        cell.setCellValue(prdCnt);
		        cell = sheet.getRow(3).getCell(16);
		        cell.setCellValue(totalModelCnt);
		        cell = sheet.getRow(3).getCell(19);
		        cell.setCellValue(whole_def_cnt);
		        cell = sheet.getRow(3).getCell(21);
		        cell.setCellValue("检验员：" + checkUser);
	            //第二行
		        cell = sheet.getRow(4).getCell(1);
		        cell.setCellValue(mdlId);
		        cell = sheet.getRow(4).getCell(3);
		        cell.setCellValue(actSoId);
		        cell = sheet.getRow(4).getCell(9);
		        cell.setCellValue(JackUtil.getCurDate());
		        cell = sheet.getRow(4).getCell(14);
		        cell.setCellValue(modelCnt);
		        cell = sheet.getRow(4).getCell(16);
		        cell.setCellValue(woId);
		        cell = sheet.getRow(4).getCell(19);
		        cell.setCellValue(whole_yield + "%");

				for (j = 0; j < 25; j++, index++) {
					if (index <= stdQty) {
						cell = sheet.getRow(j+10).getCell(0);
				        cell.setCellValue(index);
				        
				        if(!Util.isEmptyString(prdId.get(index - 1))){
							cell = sheet.getRow(j+10).getCell(1);
					        cell.setCellValue(prdId.get(index - 1));
						}
						
						if(!Util.isEmptyString(status.get(index - 1))){
							cell = sheet.getRow(j+10).getCell(2);
					        cell.setCellValue(status.get(index - 1));
						}
						
						if (!Util.isEmptyString(l_hnbl_cnt.get(index - 1)) && Integer.parseInt(l_hnbl_cnt.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+10).getCell(3);
					        cell.setCellValue(Integer.parseInt(l_hnbl_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_llhx_cnt.get(index - 1)) && Integer.parseInt(l_llhx_cnt.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+10).getCell(4);
					        cell.setCellValue(Integer.parseInt(l_llhx_cnt.get(index - 1), 10));
						}

						if (!Util.isEmptyString(l_atd_cnt.get(index - 1)) && Integer.parseInt(l_atd_cnt.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+10).getCell(5);
					        cell.setCellValue(Integer.parseInt(l_atd_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(l_ps_cnt.get(index - 1)) && Integer.parseInt(l_ps_cnt.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+10).getCell(6);
					        cell.setCellValue(Integer.parseInt(l_ps_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_lw_cnt.get(index - 1)) && Integer.parseInt(l_lw_cnt.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+10).getCell(7);
					        cell.setCellValue(Integer.parseInt(l_lw_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_hs_cnt.get(index - 1)) && Integer.parseInt(l_hs_cnt.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+10).getCell(8);
					        cell.setCellValue(Integer.parseInt(l_hs_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_zw_cnt.get(index - 1)) && Integer.parseInt(l_zw_cnt.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+10).getCell(9);
					        cell.setCellValue(Integer.parseInt(l_zw_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_ly_cnt.get(index - 1)) && Integer.parseInt(l_ly_cnt.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+10).getCell(10);
					        cell.setCellValue(Integer.parseInt(l_ly_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(l_other.get(index - 1)) && Integer.parseInt(l_other.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+10).getCell(11);
					        cell.setCellValue(Integer.parseInt(l_other.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_d_atd_cnt.get(index - 1)) && Integer.parseInt(z_d_atd_cnt.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+10).getCell(12);
					        cell.setCellValue(Integer.parseInt(z_d_atd_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_d_hs_cnt.get(index - 1)) && Integer.parseInt(z_d_hs_cnt.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+10).getCell(13);
					        cell.setCellValue(Integer.parseInt(z_d_hs_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_d_ssbj_cnt.get(index - 1)) && Integer.parseInt(z_d_ssbj_cnt.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+10).getCell(14);
					        cell.setCellValue(Integer.parseInt(z_d_ssbj_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(z_d_zw_cnt.get(index - 1)) && Integer.parseInt(z_d_zw_cnt.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+10).getCell(15);
					        cell.setCellValue(Integer.parseInt(z_d_zw_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(z_ps_cnt.get(index - 1)) && Integer.parseInt(z_ps_cnt.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+10).getCell(16);
					        cell.setCellValue(Integer.parseInt(z_ps_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(z_lw_cnt.get(index - 1)) && Integer.parseInt(z_lw_cnt.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+10).getCell(17);
					        cell.setCellValue(Integer.parseInt(z_lw_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(z_ly_cnt.get(index - 1)) && Integer.parseInt(z_ly_cnt.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+10).getCell(18);
					        cell.setCellValue(Integer.parseInt(z_ly_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_ls_cnt.get(index - 1)) && Integer.parseInt(z_ls_cnt.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+10).getCell(19);
					        cell.setCellValue(Integer.parseInt(z_ls_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_fs_cnt.get(index - 1)) && Integer.parseInt(z_fs_cnt.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+10).getCell(20);
					        cell.setCellValue(Integer.parseInt(z_fs_cnt.get(index - 1), 10));
						}	
				        
						if (!Util.isEmptyString(z_other.get(index - 1)) && Integer.parseInt(z_other.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j+10).getCell(21);
					        cell.setCellValue(Integer.parseInt(z_other.get(index - 1), 10));
						}	
				        
						if(!Util.isEmptyString(remark.get(index - 1))){
							cell = sheet.getRow(j+10).getCell(22);
					        cell.setCellValue(remark.get(index - 1));
						}
					}
				}
			}
			String filename = excel.creatFile();
			FileOutputStream fileOut = new FileOutputStream(filename);  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
	        excel.printExcel(printer,filename);
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}
	
	/**
	 * for 063客户出货信息表
	 * @param printer
	 * @param str
	 */
	public void PrintJBorDMQA063(final String printer ,final String str) {
		try {
			PrintQAFor063 printData = new PrintQAFor063();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			
			double stdQty = printData.getStdQty();
			String procId = printData.getProcId();
			String cusId = printData.getCusId();
			String woId = printData.getWoId();
			String soId = printData.getSoId();
			String boxId = printData.getBoxId();
			String prdCnt = printData.getPrdCnt();
			String modelCnt = printData.getModelCnt();
			String totalModelCnt = printData.getTotalModelCnt();
			String mdlId = printData.getMdlId();
			List<String> prdId = printData.getPrdAry();
			List<String> status = printData.getStatusAry();
			List<String> remark = printData.getRemarkAry();
			String mdlIdObj [];
			String printTyp = printData.getPrintTyp();
			String dateString = JackUtil.getCurTime();
			int loopCnt = (int) Math.ceil(stdQty / 12);
			
			String procTyp = "";
			if(procId.equals("JBQA")){
				procTyp = "JB";
			}else{
				procTyp = "DM";
			}
			
			Print excel = new Print(boxId,dateString,printTyp,"7",loopCnt,procTyp,cusId,woId);
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
			
			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
		        //读取了workbook内sheet内容  
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1))); 
				if(i == 0){
					index = 1;
				}else{
					index = index + 6;
				}
				//第一行
		        HSSFCell cell = sheet.getRow(3).getCell(1);
		        cell.setCellValue(cusId);
		        cell = sheet.getRow(3).getCell(3);
		        cell.setCellValue(soId);
		        cell = sheet.getRow(3).getCell(7);
		        cell.setCellValue(prdCnt + "/" + totalModelCnt);
	            //第二行
		        cell = sheet.getRow(4).getCell(3);
		        cell.setCellValue(boxId);
		        cell = sheet.getRow(4).getCell(5);
		        cell.setCellValue(12);			
				
				for (j = 0; j < 6; j++, index++) {
					if (index <= stdQty) {
						cell = sheet.getRow(j+6).getCell(0);
				        cell.setCellValue(index);
				        if(!Util.isEmptyString(prdId.get(index - 1))){
							cell = sheet.getRow(j+6).getCell(1);
					        cell.setCellValue(prdId.get(index - 1));
						}
						
						if(!Util.isEmptyString(status.get(index - 1))){
							cell = sheet.getRow(j+6).getCell(2);
					        cell.setCellValue(status.get(index - 1));
						}
						
						if(!Util.isEmptyString(remark.get(index - 1))){
							cell = sheet.getRow(j+6).getCell(3);
					        cell.setCellValue(remark.get(index - 1));
						}
						if((index + 6) <= stdQty){
							cell = sheet.getRow(j+6).getCell(4);
					        cell.setCellValue(index + 6);
					        if(!Util.isEmptyString(prdId.get(index - 1 + 6))){
								cell = sheet.getRow(j+6).getCell(5);
						        cell.setCellValue(prdId.get(index - 1 + 6));
							}
					        
							if(!Util.isEmptyString(status.get(index - 1 + 6))){
								cell = sheet.getRow(j+6).getCell(6);
						        cell.setCellValue(status.get(index - 1 + 6));
							}
							
							if(!Util.isEmptyString(remark.get(index - 1 + 6))){
								cell = sheet.getRow(j+6).getCell(7);
						        cell.setCellValue(remark.get(index - 1 + 6));
							}
						}
					}
				}
				
				if(mdlId.indexOf("/")!=-1){//更具/分隔
					mdlIdObj= mdlId.split("\\/");
					cell = sheet.getRow(4).getCell(1);
			        cell.setCellValue(mdlIdObj[1]);
					cell = sheet.getRow(12).getCell(1);
			        cell.setCellValue(mdlIdObj[0]);
				}else{
					cell = sheet.getRow(4).getCell(1);
			        cell.setCellValue(mdlId);
				}
				
				cell = sheet.getRow(13).getCell(1);
		        cell.setCellValue(totalModelCnt + "粒");
				cell = sheet.getRow(13).getCell(7);
		        cell.setCellValue(woId);
			}
			String filename = excel.creatFile();
			FileOutputStream fileOut = new FileOutputStream(filename);  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
	        excel.printExcel(printer,filename);
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}
	/**
	 * for 098客户 for JBQA
	 * @param printer
	 * @param str
	 */
	public void PrintJBQA098(final String printer ,final String str) {
		try {
			PrintQAFor098 printData = new PrintQAFor098();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			
			double stdQty = printData.getStdQty();
			String procId = printData.getProcId();
			String cusId = printData.getCusId();
			String woId = printData.getWoId();
			String soId = printData.getSoId();
			String boxId = printData.getBoxId();
			String toThickness = printData.getToThickness();
			String prdCnt = printData.getPrdCnt();
			String modelCnt = printData.getModelCnt();
			String totalModelCnt = printData.getTotalModelCnt();
			String mdlId = printData.getMdlId();
			List<String> prdId = printData.getPrdAry();
			List<String> mtrlBox = printData.getMtrlBoxAry();
			List<String> C_z_pl_cnt = printData.getCzPlAry();
			List<String> C_z_ly_cnt = printData.getCzLyAry();
			List<String> C_z_zw_cnt = printData.getCzZwAry();
			List<String> C_z_skbj_cnt = printData.getCzSkbjAry();
			List<String> C_z_atd_cnt = printData.getCzAtdAry();
			List<String> C_z_hs_cnt = printData.getCzHsAry();
			List<String> C_l_pl_cnt = printData.getClPlAry();
			List<String> C_l_yjyc_cnt = printData.getClYjycAry();
			List<String> C_l_ad_cnt = printData.getClAdAry();
			List<String> C_l_mjad_cnt = printData.getClMjadAry();
			List<String> C_l_hs_cnt = printData.getClHsAry();
			List<String> C_l_gly_cnt = printData.getClGlyAry();
			List<String> T_z_zw_cnt = printData.getTzZwAry();
			List<String> T_z_skbj_cnt = printData.getTzSkbjAry();
			List<String> T_z_atd_cnt = printData.getTzAtdAry();
			List<String> T_z_hs_cnt = printData.getTzHsAry();
			List<String> T_l_ad_cnt = printData.getTlAdAry();
			List<String> T_l_hs_cnt = printData.getTlHsAry();
			List<String> T_l_gly_cnt = printData.getTlGlyAry();
			List<String> total_Def = printData.getTotalAry();
			List<String> status = printData.getStatusAry();
			List<String> remark = printData.getRemarkAry();
			String printTyp = printData.getPrintTyp();
			String dateString = JackUtil.getCurTime();
			int loopCnt = (int) Math.ceil(stdQty / 10);
			
			String procTyp = "";
			if(procId.equals("JBQA")){
				procTyp = "JB";
			}else{
				procTyp = "DM";
			}
			
			Print excel = new Print(boxId,dateString,printTyp,"A",loopCnt,procTyp,cusId,woId);
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
		        //读取了workbook内sheet内容  
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1))); 
				
				int totalDef1 = 0;
				int totalDef2 = 0;
				int totalDef3 = 0;
				int totalDef4 = 0;
				int totalDef5 = 0;
				int totalDef6 = 0;
				int totalDef7 = 0;
				int totalDef8 = 0;
				int totalDef9 = 0; 
				int totalDef10 = 0;
				int totalDef11 = 0;
				int totalDef12 = 0;
				int totalDef13 = 0;
				int totalDef14 = 0;
				int totalDef15 = 0;
				int totalDef16 = 0;
				int totalDef17 = 0;
				int totalDef18 = 0;
				int totalDef19 = 0;
				int totalDef = 0;
				//第一行
		        HSSFCell cell = sheet.getRow(3).getCell(1);
		        cell.setCellValue(cusId);
		        cell = sheet.getRow(3).getCell(5);
		        cell.setCellValue(soId);
		        cell = sheet.getRow(3).getCell(13);
		        cell.setCellValue(boxId);
		        cell = sheet.getRow(3).getCell(20);
		        cell.setCellValue(toThickness + "mm");
			    cell = sheet.getRow(3).getCell(24);
		        cell.setCellValue(mdlId);

	            //第二行
		        cell = sheet.getRow(4).getCell(1);
		        cell.setCellValue(Integer.parseInt(prdCnt, 10));
		        cell = sheet.getRow(4).getCell(5);
		        cell.setCellValue(JackUtil.getCurDate());
		        cell = sheet.getRow(4).getCell(20);
		        cell.setCellValue(Integer.parseInt(modelCnt, 10));
			    cell = sheet.getRow(4).getCell(24);
		        cell.setCellValue(woId);
		        				
				for (j = 0; j < 10; j++, index++) {
					if (index <= stdQty) {
						cell = sheet.getRow(j+7).getCell(0);
				        cell.setCellValue(index);
				        
						if(!Util.isEmptyString(prdId.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(1);
					        cell.setCellValue(prdId.get(index - 1));
						}
						
						if(!Util.isEmptyString(mtrlBox.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(2);
					        cell.setCellValue(mtrlBox.get(index - 1));
						}
						
						if(!Util.isEmptyString(status.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(3);
					        cell.setCellValue(status.get(index - 1));
						}
						
						if (!Util.isEmptyString(C_z_pl_cnt.get(index - 1)) && Integer.parseInt(C_z_pl_cnt.get(index - 1), 10) != 0) {
							totalDef1 = totalDef1 + Integer.parseInt(C_z_pl_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(4);
							cell.setCellValue(Integer.parseInt(C_z_pl_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_z_ly_cnt.get(index - 1)) && Integer.parseInt(C_z_ly_cnt.get(index - 1), 10) != 0) {
							totalDef2 = totalDef2 + Integer.parseInt(C_z_ly_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(5);
							cell.setCellValue(Integer.parseInt(C_z_ly_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_z_zw_cnt.get(index - 1)) && Integer.parseInt(C_z_zw_cnt.get(index - 1), 10) != 0) {
							totalDef3 = totalDef3 + Integer.parseInt(C_z_zw_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(6);
							cell.setCellValue(Integer.parseInt(C_z_zw_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_z_skbj_cnt.get(index - 1)) && Integer.parseInt(C_z_skbj_cnt.get(index - 1), 10) != 0) {
							totalDef4 = totalDef4 + Integer.parseInt(C_z_skbj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(7);
							cell.setCellValue(Integer.parseInt(C_z_skbj_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_z_atd_cnt.get(index - 1)) && Integer.parseInt(C_z_atd_cnt.get(index - 1), 10) != 0) {
							totalDef5 = totalDef5 + Integer.parseInt(C_z_atd_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(8);
							cell.setCellValue(Integer.parseInt(C_z_atd_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_z_hs_cnt.get(index - 1)) && Integer.parseInt(C_z_hs_cnt.get(index - 1), 10) != 0) {
							totalDef6 = totalDef6 + Integer.parseInt(C_z_hs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(9);
							cell.setCellValue(Integer.parseInt(C_z_hs_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_l_pl_cnt.get(index - 1)) && Integer.parseInt(C_l_pl_cnt.get(index - 1), 10) != 0) {
							totalDef7 = totalDef7 + Integer.parseInt(C_l_pl_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(10);
							cell.setCellValue(Integer.parseInt(C_l_pl_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_l_yjyc_cnt.get(index - 1)) && Integer.parseInt(C_l_yjyc_cnt.get(index - 1), 10) != 0) {
							totalDef8 = totalDef8 + Integer.parseInt(C_l_yjyc_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(11);
							cell.setCellValue(Integer.parseInt(C_l_yjyc_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_l_ad_cnt.get(index - 1)) && Integer.parseInt(C_l_ad_cnt.get(index - 1), 10) != 0) {
							totalDef9 = totalDef9 + Integer.parseInt(C_l_ad_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(12);
							cell.setCellValue(Integer.parseInt(C_l_ad_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_l_mjad_cnt.get(index - 1)) && Integer.parseInt(C_l_mjad_cnt.get(index - 1), 10) != 0) {
							totalDef10 = totalDef10 + Integer.parseInt(C_l_mjad_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(13);
							cell.setCellValue(Integer.parseInt(C_l_mjad_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_l_hs_cnt.get(index - 1)) && Integer.parseInt(C_l_hs_cnt.get(index - 1), 10) != 0) {
							totalDef11 = totalDef11 + Integer.parseInt(C_l_hs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(14);
							cell.setCellValue(Integer.parseInt(C_l_hs_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(C_l_gly_cnt.get(index - 1)) && Integer.parseInt(C_l_gly_cnt.get(index - 1), 10) != 0) {
							totalDef12 = totalDef12 + Integer.parseInt(C_l_gly_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(15);
							cell.setCellValue(Integer.parseInt(C_l_gly_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(T_z_zw_cnt.get(index - 1)) && Integer.parseInt(T_z_zw_cnt.get(index - 1), 10) != 0) {
							totalDef13 = totalDef13 + Integer.parseInt(T_z_zw_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(16);
							cell.setCellValue(Integer.parseInt(T_z_zw_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(T_z_skbj_cnt.get(index - 1)) && Integer.parseInt(T_z_skbj_cnt.get(index - 1), 10) != 0) {
							totalDef14 = totalDef14 + Integer.parseInt(T_z_skbj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(17);
							cell.setCellValue(Integer.parseInt(T_z_skbj_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(T_z_atd_cnt.get(index - 1)) && Integer.parseInt(T_z_atd_cnt.get(index - 1), 10) != 0) {
							totalDef15 = totalDef15 + Integer.parseInt(T_z_atd_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(18);
							cell.setCellValue(Integer.parseInt(T_z_atd_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(T_z_hs_cnt.get(index - 1)) && Integer.parseInt(T_z_hs_cnt.get(index - 1), 10) != 0) {
							totalDef16 = totalDef16 + Integer.parseInt(T_z_hs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(19);
							cell.setCellValue(Integer.parseInt(T_z_hs_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(T_l_ad_cnt.get(index - 1)) && Integer.parseInt(T_l_ad_cnt.get(index - 1), 10) != 0) {
							totalDef17 = totalDef17 + Integer.parseInt(T_l_ad_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(20);
							cell.setCellValue(Integer.parseInt(T_l_ad_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(T_l_hs_cnt.get(index - 1)) && Integer.parseInt(T_l_hs_cnt.get(index - 1), 10) != 0) {
							totalDef18 = totalDef18 + Integer.parseInt(T_l_hs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(21);
							cell.setCellValue(Integer.parseInt(T_l_hs_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(T_l_gly_cnt.get(index - 1)) && Integer.parseInt(T_l_gly_cnt.get(index - 1), 10) != 0) {
							totalDef19 = totalDef19 + Integer.parseInt(T_l_gly_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(22);
							cell.setCellValue(Integer.parseInt(T_l_gly_cnt.get(index - 1), 10));
						}
						
						if(!Util.isEmptyString(total_Def.get(index - 1))){
							totalDef = totalDef + Integer.parseInt(total_Def.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(23);
							cell.setCellValue(Integer.parseInt(total_Def.get(index - 1), 10));
						}
						
						if(!Util.isEmptyString(remark.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(24);
					        cell.setCellValue(remark.get(index - 1));
						}						
					}
				}
				cell = sheet.getRow(17).getCell(4);
		        cell.setCellValue(totalDef1);
		        cell = sheet.getRow(17).getCell(5);
		        cell.setCellValue(totalDef2);
		        cell = sheet.getRow(17).getCell(6);
		        cell.setCellValue(totalDef3);
		        cell = sheet.getRow(17).getCell(7);
		        cell.setCellValue(totalDef4);
		        cell = sheet.getRow(17).getCell(8);
		        cell.setCellValue(totalDef5);
		        cell = sheet.getRow(17).getCell(9);
		        cell.setCellValue(totalDef6);
		        cell = sheet.getRow(17).getCell(10);
		        cell.setCellValue(totalDef7);
		        cell = sheet.getRow(17).getCell(11);
		        cell.setCellValue(totalDef8);
		        cell = sheet.getRow(17).getCell(12);
		        cell.setCellValue(totalDef9);
		        cell = sheet.getRow(17).getCell(13);
		        cell.setCellValue(totalDef10);
		        cell = sheet.getRow(17).getCell(14);
		        cell.setCellValue(totalDef11);
		        cell = sheet.getRow(17).getCell(15);
		        cell.setCellValue(totalDef12);
		        cell = sheet.getRow(17).getCell(16);
		        cell.setCellValue(totalDef13);
		        cell = sheet.getRow(17).getCell(17);
		        cell.setCellValue(totalDef14);
		        cell = sheet.getRow(17).getCell(18);
		        cell.setCellValue(totalDef15);
		        cell = sheet.getRow(17).getCell(19);
		        cell.setCellValue(totalDef16);
		        cell = sheet.getRow(17).getCell(20);
		        cell.setCellValue(totalDef17);
		        cell = sheet.getRow(17).getCell(21);
		        cell.setCellValue(totalDef18);
		        cell = sheet.getRow(17).getCell(22);
		        cell.setCellValue(totalDef19);
		        cell = sheet.getRow(17).getCell(23);
		        cell.setCellValue(totalDef);
			}
			String filename = excel.creatFile();
			FileOutputStream fileOut = new FileOutputStream(filename);  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
	        excel.printExcel(printer,filename);
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}
	/**
	 * for 098客户DMQA出货信息表
	 * @param printer
	 * @param str
	 */
	public void PrintDMQA098(final String printer ,final String str) {
		try {
			PrintQAForTM printData = new PrintQAForTM();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			
			double stdQty = printData.getStdQty();
			String procId = printData.getProcId();
			String cusId = printData.getCusId();
			String boxId = printData.getBoxId();
			String prdCnt = printData.getPrdCnt();
			String toThickness = printData.getToThickness();
			String totalModelCnt = printData.getTotalModelCnt();
			String modelCnt = printData.getModelCnt();
			String mdlId = printData.getMdlId();
			List<String> prdId = printData.getPrdAry();
			List<String> yjyc_cnt = printData.getYjycAry();
			List<String> sy_cnt = printData.getSyAry();
			List<String> C_hs_cnt = printData.getcHsAry();
			List<String> C_ad_cnt = printData.getcAdAry();
			List<String> C_td_cnt = printData.getcTdAry();
			List<String> C_shbj_cnt = printData.getcShbjAry();
			List<String> C_ps_cnt = printData.getcPsAry();
			List<String> C_zw_cnt = printData.getcZwAry();
			List<String> C_ly_cnt = printData.getcLyAry();
			List<String> C_other = printData.getcOtherAry();
			List<String> T_hs_cnt = printData.gettHsAry();
			List<String> T_ad_cnt = printData.gettAdAry();
			List<String> T_td_cnt = printData.gettTdAry();
			List<String> T_shbj_cnt = printData.gettShbjAry();
			List<String> T_ps_cnt = printData.gettPsAry();
			List<String> T_zw_cnt = printData.gettZwAry();
			List<String> T_ly_cnt = printData.gettLyAry();
			List<String> T_other = printData.gettOtherAry();
			List<String> remark = printData.getRemarkAry();
			String woId = printData.getWoId();
			String whole_def_cnt = printData.getWhole_def_cnt();
			String whole_yield = printData.getWhole_yield();
			String checkUser = printData.getCheckUser();
			String printTyp = printData.getPrintTyp();
			String dateString = JackUtil.getCurTime();
			int loopCnt = (int) Math.ceil(stdQty / 10);
			
			String procTyp = "";
			if(procId.equals("JBQA")){
				procTyp = "JB";
			}else{
				procTyp = "DM";
			}
			
			Print excel = new Print(boxId,dateString,printTyp,"8",loopCnt,procTyp,cusId,woId);
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
			
			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
		        //读取了workbook内sheet内容  
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1))); 
				
				int totalyjyc = 0;
				int totalsy = 0;
				int totalChs = 0;
				int totalCad = 0;
				int totalCtd = 0;
				int totalCshbj = 0;
				int totalCps = 0;
				int totalCzw = 0;
				int totalCly = 0;
				int totalCother = 0;
				int totalThs = 0;
				int totalTad = 0;
				int totalTtd = 0;
				int totalTshbj = 0;
				int totalTps = 0;
				int totalTzw = 0;
				int totalTly = 0;
				int totalTother = 0;
				int total = 0;
				double step_y = 3.8;

				//第一行
		        HSSFCell cell = sheet.getRow(3).getCell(1);
		        cell.setCellValue(cusId);
		        cell = sheet.getRow(3).getCell(4);
		        cell.setCellValue(toThickness + "mm");
		        cell = sheet.getRow(3).getCell(9);
		        cell.setCellValue(boxId);
		        cell = sheet.getRow(3).getCell(15);
		        cell.setCellValue(Integer.parseInt(prdCnt, 10));
			    cell = sheet.getRow(3).getCell(17);
		        cell.setCellValue(Integer.parseInt(whole_def_cnt, 10));
			    cell = sheet.getRow(3).getCell(19);
		        cell.setCellValue("检验员：" + checkUser);
	            //第二行
		        cell = sheet.getRow(4).getCell(1);
		        cell.setCellValue(mdlId);
		        cell = sheet.getRow(4).getCell(4);
		        cell.setCellValue(woId);
		        cell = sheet.getRow(4).getCell(9);
		        cell.setCellValue(JackUtil.getCurDate());
		        cell = sheet.getRow(4).getCell(15);
		        cell.setCellValue(Integer.parseInt(modelCnt, 10));
			    cell = sheet.getRow(4).getCell(17);
		        cell.setCellValue(whole_yield + "%");	

				for (j = 0; j < 10; j++, index++) {
					if (index <= stdQty) {
						cell = sheet.getRow(j+8).getCell(0);
				        cell.setCellValue(index);
				        
						if(!Util.isEmptyString(prdId.get(index - 1))){
							cell = sheet.getRow(j+8).getCell(1);
					        cell.setCellValue(prdId.get(index - 1));
						}

						if (!Util.isEmptyString(yjyc_cnt.get(index - 1)) && Integer.parseInt(yjyc_cnt.get(index - 1), 10) != 0) {
							totalyjyc = totalyjyc + Integer.parseInt(yjyc_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(2);
					        cell.setCellValue(Integer.parseInt(yjyc_cnt.get(index - 1), 10));
						}
						if (!Util.isEmptyString(sy_cnt.get(index - 1)) && Integer.parseInt(sy_cnt.get(index - 1), 10) != 0) {
							totalsy = totalsy + Integer.parseInt(sy_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(3);
					        cell.setCellValue(Integer.parseInt(sy_cnt.get(index - 1), 10));
						}
						if (!Util.isEmptyString(C_hs_cnt.get(index - 1)) && Integer.parseInt(C_hs_cnt.get(index - 1), 10) != 0) {
							totalChs = totalChs + Integer.parseInt(C_hs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(4);
					        cell.setCellValue(Integer.parseInt(C_hs_cnt.get(index - 1), 10));
						}
						if (!Util.isEmptyString(C_ad_cnt.get(index - 1)) && Integer.parseInt(C_ad_cnt.get(index - 1), 10) != 0) {
							totalCad = totalCad + Integer.parseInt(C_ad_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(5);
					        cell.setCellValue(Integer.parseInt(C_ad_cnt.get(index - 1), 10));
						}
						if (!Util.isEmptyString(C_td_cnt.get(index - 1)) && Integer.parseInt(C_td_cnt.get(index - 1), 10) != 0) {
							totalCtd = totalCtd + Integer.parseInt(C_td_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(6);
					        cell.setCellValue(Integer.parseInt(C_td_cnt.get(index - 1), 10));
						}
						if (!Util.isEmptyString(C_shbj_cnt.get(index - 1)) && Integer.parseInt(C_shbj_cnt.get(index - 1), 10) != 0) {
							totalCshbj = totalCshbj + Integer.parseInt(C_shbj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(7);
					        cell.setCellValue(Integer.parseInt(C_shbj_cnt.get(index - 1), 10));
						}
						if (!Util.isEmptyString(C_ps_cnt.get(index - 1)) && Integer.parseInt(C_ps_cnt.get(index - 1), 10) != 0) {
							totalCps = totalCps + Integer.parseInt(C_ps_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(8);
					        cell.setCellValue(Integer.parseInt(C_ps_cnt.get(index - 1), 10));
						}
						if (!Util.isEmptyString(C_zw_cnt.get(index - 1)) && Integer.parseInt(C_zw_cnt.get(index - 1), 10) != 0) {
							totalCzw = totalCzw + Integer.parseInt(C_zw_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(9);
					        cell.setCellValue(Integer.parseInt(C_zw_cnt.get(index - 1), 10));
						}
						if (!Util.isEmptyString(C_ly_cnt.get(index - 1)) && Integer.parseInt(C_ly_cnt.get(index - 1), 10) != 0) {
							totalCly = totalCly + Integer.parseInt(C_ly_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(10);
					        cell.setCellValue(Integer.parseInt(C_ly_cnt.get(index - 1), 10));
						}
						if (!Util.isEmptyString(C_other.get(index - 1)) && Integer.parseInt(C_other.get(index - 1), 10) != 0) {
							totalCother = totalCother + Integer.parseInt(C_other.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(11);
					        cell.setCellValue(Integer.parseInt(C_other.get(index - 1), 10));
						}
						if (!Util.isEmptyString(T_hs_cnt.get(index - 1)) && Integer.parseInt(T_hs_cnt.get(index - 1), 10) != 0) {
							totalThs = totalThs + Integer.parseInt(T_hs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(12);
					        cell.setCellValue(Integer.parseInt(T_hs_cnt.get(index - 1), 10));
						}
						if (!Util.isEmptyString(T_ad_cnt.get(index - 1)) && Integer.parseInt(T_ad_cnt.get(index - 1), 10) != 0) {
							totalTad = totalTad + Integer.parseInt(T_ad_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(13);
					        cell.setCellValue(Integer.parseInt(T_ad_cnt.get(index - 1), 10));
						}
						if (!Util.isEmptyString(T_td_cnt.get(index - 1)) && Integer.parseInt(T_td_cnt.get(index - 1), 10) != 0) {
							totalTtd = totalTtd + Integer.parseInt(T_td_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(14);
					        cell.setCellValue(Integer.parseInt(T_td_cnt.get(index - 1), 10));
						}
						if (!Util.isEmptyString(T_shbj_cnt.get(index - 1)) && Integer.parseInt(T_shbj_cnt.get(index - 1), 10) != 0) {
							totalTshbj = totalTshbj + Integer.parseInt(T_shbj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(15);
					        cell.setCellValue(Integer.parseInt(T_shbj_cnt.get(index - 1), 10));
						}
						if (!Util.isEmptyString(T_ps_cnt.get(index - 1)) && Integer.parseInt(T_ps_cnt.get(index - 1), 10) != 0) {
							totalTps = totalTps + Integer.parseInt(T_ps_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(16);
					        cell.setCellValue(Integer.parseInt(T_ps_cnt.get(index - 1), 10));
						}
						if (!Util.isEmptyString(T_zw_cnt.get(index - 1)) && Integer.parseInt(T_zw_cnt.get(index - 1), 10) != 0) {
							totalTzw = totalTzw + Integer.parseInt(T_zw_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(17);
					        cell.setCellValue(Integer.parseInt(T_zw_cnt.get(index - 1), 10));
						}
						if (!Util.isEmptyString(T_ly_cnt.get(index - 1)) && Integer.parseInt(T_ly_cnt.get(index - 1), 10) != 0) {
							totalTly = totalTly + Integer.parseInt(T_ly_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(18);
					        cell.setCellValue(Integer.parseInt(T_ly_cnt.get(index - 1), 10));
						}
						if (!Util.isEmptyString(T_other.get(index - 1)) && Integer.parseInt(T_other.get(index - 1), 10) != 0) {
							totalTother = totalTother + Integer.parseInt(T_other.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(19);
					        cell.setCellValue(Integer.parseInt(T_other.get(index - 1), 10));
						}					
						if(!Util.isEmptyString(remark.get(index - 1))){
							cell = sheet.getRow(j+8).getCell(20);
					        cell.setCellValue(remark.get(index - 1));
						}
					}
				}
				cell = sheet.getRow(18).getCell(2);
		        cell.setCellValue(totalyjyc);
		        cell = sheet.getRow(18).getCell(3);
		        cell.setCellValue(totalsy);
		        cell = sheet.getRow(18).getCell(4);
		        cell.setCellValue(totalChs);
		        cell = sheet.getRow(18).getCell(5);
		        cell.setCellValue(totalCad);
		        cell = sheet.getRow(18).getCell(6);
		        cell.setCellValue(totalCtd);
		        cell = sheet.getRow(18).getCell(7);
		        cell.setCellValue(totalCshbj);
		        cell = sheet.getRow(18).getCell(8);
		        cell.setCellValue(totalCps);
		        cell = sheet.getRow(18).getCell(9);
		        cell.setCellValue(totalCzw);
		        cell = sheet.getRow(18).getCell(10);
		        cell.setCellValue(totalCly);
		        cell = sheet.getRow(18).getCell(11);
		        cell.setCellValue(totalCother);
		        cell = sheet.getRow(18).getCell(12);
		        cell.setCellValue(totalThs);
		        cell = sheet.getRow(18).getCell(13);
		        cell.setCellValue(totalTad);
		        cell = sheet.getRow(18).getCell(14);
		        cell.setCellValue(totalTtd);
		        cell = sheet.getRow(18).getCell(15);
		        cell.setCellValue(totalTshbj);
		        cell = sheet.getRow(18).getCell(16);
		        cell.setCellValue(totalTps);
		        cell = sheet.getRow(18).getCell(17);
		        cell.setCellValue(totalTzw);
		        cell = sheet.getRow(18).getCell(18);
		        cell.setCellValue(totalTly);
		        cell = sheet.getRow(18).getCell(19);
		        cell.setCellValue(totalTother);
				//脏污、破损、液晶异常不计入
				total = totalsy + totalChs + totalCad + totalCtd + totalCshbj
						+ totalCly + totalCother + totalThs + totalTad + totalTtd + totalTshbj 
						+ totalTly + totalTother ;
		        cell = sheet.getRow(19).getCell(20);
		        cell.setCellValue("不良CELL检出总数：" + total);
			}
			String filename = excel.creatFile();
			FileOutputStream fileOut = new FileOutputStream(filename);  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
	        excel.printExcel(printer,filename);
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}
	
	/**
	 * for 028,071,088 天马客户 & 006DMQA出货信息表
	 * @param printer
	 * @param str
	 */
	public void PrintJBorDMQA2(final String printer ,final String str){
		try {
			String dateString = JackUtil.getCurTime();
			PrintQAForTM printData = new PrintQAForTM();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			
			double stdQty = printData.getStdQty();
			String procId = printData.getProcId();
			String cusId = printData.getCusId();
			String boxId = printData.getBoxId();
			String prdCnt = printData.getPrdCnt();
			String mdlSize = printData.getMdlSize();//2.产品规格
			String toThickness = printData.getToThickness();
			String totalModelCnt = printData.getTotalModelCnt();
			String modelCnt = printData.getModelCnt();
			String mdlId = printData.getMdlId();
			List<String> prdId = printData.getPrdAry();
			List<String> yjyc_cnt = printData.getYjycAry();
			List<String> sy_cnt = printData.getSyAry();
			List<String> C_hs_cnt = printData.getcHsAry();
			List<String> C_ad_cnt = printData.getcAdAry();
			List<String> C_td_cnt = printData.getcTdAry();
			List<String> C_shbj_cnt = printData.getcShbjAry();
			List<String> C_ps_cnt = printData.getcPsAry();
			List<String> C_zw_cnt = printData.getcZwAry();
			List<String> C_ly_cnt = printData.getcLyAry();
			List<String> C_other = printData.getcOtherAry();
			List<String> T_hs_cnt = printData.gettHsAry();
			List<String> T_ad_cnt = printData.gettAdAry();
			List<String> T_td_cnt = printData.gettTdAry();
			List<String> T_shbj_cnt = printData.gettShbjAry();
			List<String> T_ps_cnt = printData.gettPsAry();
			List<String> T_zw_cnt = printData.gettZwAry();
			List<String> T_ly_cnt = printData.gettLyAry();
			List<String> T_other = printData.gettOtherAry();
			List<String> remark = printData.getRemarkAry();
			String woId = printData.getWoId();
			String whole_def_cnt = printData.getWhole_def_cnt();
			String whole_yield = printData.getWhole_yield();
			String checkUser = printData.getCheckUser();
//			String printTyp = printData.getPrintTyp();
			String printTyp = "B";
			String modelTyp = "2";
			String shipBoxId = printData.getShipBoxId();
			int m = 25;
			int n = 33;
			int loopCnt = 1;
			if(cusId.equals("006") || cusId.equals("005")){
				m = 30;
				n = 38;
				//loopCnt = (int) Math.ceil(stdQty / 30);
				loopCnt = 1;
				modelTyp = "2";
			}else{
				m = 25;
				n = 33;
				loopCnt = (int) Math.ceil(stdQty / 25);
				modelTyp = "3";
			}
			
			String procTyp = "";
			if("JBQA".equals(procId)){
				procTyp = "JB";
			}else{
				procTyp = "DM";
			}
			
			Print excel = new Print(boxId,dateString,printTyp,modelTyp,loopCnt,procTyp,cusId,woId);
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();

			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
		        //读取了workbook内sheet内容  
		        HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1))); 

				int totalyjyc = 0;
				int totalsy = 0;
				int totalChs = 0;
				int totalCad = 0;
				int totalCtd = 0;
				int totalCshbj = 0;
				int totalCps = 0;
				int totalCzw = 0;
				int totalCly = 0;
				int totalCother = 0;
				int totalThs = 0;
				int totalTad = 0;
				int totalTtd = 0;
				int totalTshbj = 0;
				int totalTps = 0;
				int totalTzw = 0;
				int totalTly = 0;
				int totalTother = 0;

				//第一行
		        HSSFCell cell = sheet.getRow(3).getCell(1);//1.客户名称
		        cell.setCellValue(cusId);
		        cell = sheet.getRow(3).getCell(4);//2.产品规格
		        cell.setCellValue(toThickness);
		        cell = sheet.getRow(3).getCell(9);// 3.原箱lot
		        cell.setCellValue(boxId);
		        cell = sheet.getRow(3).getCell(15);//4.箱内数量
		        cell.setCellValue(Integer.parseInt(prdCnt, 10));
		        if(cusId.equals("006") || cusId.equals("005")){
			        cell = sheet.getRow(3).getCell(17);//5.不良cell总数
				}else{
			        cell = sheet.getRow(3).getCell(18); 
				}
		        cell.setCellValue(Integer.parseInt(whole_def_cnt, 10));
		        if(cusId.equals("006") || cusId.equals("005")){
			        cell = sheet.getRow(3).getCell(19);//6.检验员
				}else{
			        cell = sheet.getRow(3).getCell(20); 
				}
		        cell.setCellValue("检验员：" + checkUser);
	            //第二行
		        cell = sheet.getRow(4).getCell(1);//产品型号
		        cell.setCellValue(mdlId);
		        cell = sheet.getRow(4).getCell(4);//生产批号
		        cell.setCellValue(woId);
		        cell = sheet.getRow(4).getCell(9);//出货检测日期
		        cell.setCellValue(JackUtil.getCurDate());
		        cell = sheet.getRow(4).getCell(15);//集成度
		        cell.setCellValue(Integer.parseInt(modelCnt, 10));
		        if(cusId.equals("006") || cusId.equals("005")){
			        cell = sheet.getRow(4).getCell(17);
				}else{
			        cell = sheet.getRow(4).getCell(18);
			        
				}
		        cell.setCellValue(whole_yield + "%");//总良率
		        
				for (j = 0; j < m; j++, index++) {
					if (index <= stdQty) {
						cell = sheet.getRow(j+8).getCell(0);
				        cell.setCellValue(index);//序号
				        
						if(!Util.isEmptyString(prdId.get(index - 1))){
							cell = sheet.getRow(j+8).getCell(1);
					        cell.setCellValue(prdId.get(index - 1));//玻璃ID
						}

						if (!Util.isEmptyString(yjyc_cnt.get(index - 1)) && Integer.parseInt(yjyc_cnt.get(index - 1), 10) != 0) {
							totalyjyc = totalyjyc + Integer.parseInt(yjyc_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(2);
					        cell.setCellValue(Integer.parseInt(yjyc_cnt.get(index - 1), 10));//液晶异常
						}

						if (!Util.isEmptyString(sy_cnt.get(index - 1)) && Integer.parseInt(sy_cnt.get(index - 1), 10) != 0) {
							totalsy = totalsy + Integer.parseInt(sy_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(3);
					        cell.setCellValue(Integer.parseInt(sy_cnt.get(index - 1), 10));//渗液
						}
				        
						if (!Util.isEmptyString(C_hs_cnt.get(index - 1)) && Integer.parseInt(C_hs_cnt.get(index - 1), 10) != 0) {
							totalChs = totalChs + Integer.parseInt(C_hs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(4);
					        cell.setCellValue(Integer.parseInt(C_hs_cnt.get(index - 1), 10));//C划伤
						}
				        
						if (!Util.isEmptyString(C_ad_cnt.get(index - 1)) && Integer.parseInt(C_ad_cnt.get(index - 1), 10) != 0) {
							totalCad = totalCad + Integer.parseInt(C_ad_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(5);
					        cell.setCellValue(Integer.parseInt(C_ad_cnt.get(index - 1), 10));//C凹点
						}
				        
						if (!Util.isEmptyString(C_td_cnt.get(index - 1)) && Integer.parseInt(C_td_cnt.get(index - 1), 10) != 0) {
							totalCtd = totalCtd + Integer.parseInt(C_td_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(6);
					        cell.setCellValue(Integer.parseInt(C_td_cnt.get(index - 1), 10));//C凸点
						}
				        
						if (!Util.isEmptyString(C_shbj_cnt.get(index - 1)) && Integer.parseInt(C_shbj_cnt.get(index - 1), 10) != 0) {
							totalCshbj = totalCshbj + Integer.parseInt(C_shbj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(7);
					        cell.setCellValue(Integer.parseInt(C_shbj_cnt.get(index - 1), 10));//C酸蚀不匀
						}
				        
						if (!Util.isEmptyString(C_ps_cnt.get(index - 1)) && Integer.parseInt(C_ps_cnt.get(index - 1), 10) != 0) {
							totalCps = totalCps + Integer.parseInt(C_ps_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(8);
					        cell.setCellValue(Integer.parseInt(C_ps_cnt.get(index - 1), 10));//C破损
						}

						if (!Util.isEmptyString(C_zw_cnt.get(index - 1)) && Integer.parseInt(C_zw_cnt.get(index - 1), 10) != 0) {
							totalCzw = totalCzw + Integer.parseInt(C_zw_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(9);
					        cell.setCellValue(Integer.parseInt(C_zw_cnt.get(index - 1), 10));//C脏污
						}
				        
						if (!Util.isEmptyString(C_ly_cnt.get(index - 1)) && Integer.parseInt(C_ly_cnt.get(index - 1), 10) != 0) {
							totalCly = totalCly + Integer.parseInt(C_ly_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(10);
					        cell.setCellValue(Integer.parseInt(C_ly_cnt.get(index - 1), 10));//C轮印
						}

						if (!Util.isEmptyString(C_other.get(index - 1)) && Integer.parseInt(C_other.get(index - 1), 10) != 0) {
							totalCother = totalCother + Integer.parseInt(C_other.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(11);
					        cell.setCellValue(Integer.parseInt(C_other.get(index - 1), 10));//C其他不良
						}
				        
						if (!Util.isEmptyString(T_hs_cnt.get(index - 1)) && Integer.parseInt(T_hs_cnt.get(index - 1), 10) != 0) {
							totalThs = totalThs + Integer.parseInt(T_hs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(12);
					        cell.setCellValue(Integer.parseInt(T_hs_cnt.get(index - 1), 10));//T划伤
						}
				        
						if (!Util.isEmptyString(T_ad_cnt.get(index - 1)) && Integer.parseInt(T_ad_cnt.get(index - 1), 10) != 0) {
							totalTad = totalTad + Integer.parseInt(T_ad_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(13);
					        cell.setCellValue(Integer.parseInt(T_ad_cnt.get(index - 1), 10));//T凹点
						}
				        
						if (!Util.isEmptyString(T_td_cnt.get(index - 1)) && Integer.parseInt(T_td_cnt.get(index - 1), 10) != 0) {
							totalTtd = totalTtd + Integer.parseInt(T_td_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(14);
					        cell.setCellValue(Integer.parseInt(T_td_cnt.get(index - 1), 10));//T凸点
						}
				        
						if (!Util.isEmptyString(T_shbj_cnt.get(index - 1)) && Integer.parseInt(T_shbj_cnt.get(index - 1), 10) != 0) {
							totalTshbj = totalTshbj + Integer.parseInt(T_shbj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(15);
					        cell.setCellValue(Integer.parseInt(T_shbj_cnt.get(index - 1), 10));//T酸蚀不匀
						}
				        
						if (!Util.isEmptyString(T_ps_cnt.get(index - 1)) && Integer.parseInt(T_ps_cnt.get(index - 1), 10) != 0) {
							totalTps = totalTps + Integer.parseInt(T_ps_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(16);
					        cell.setCellValue(Integer.parseInt(T_ps_cnt.get(index - 1), 10));//T破损
						}
				        
						if (!Util.isEmptyString(T_zw_cnt.get(index - 1)) && Integer.parseInt(T_zw_cnt.get(index - 1), 10) != 0) {
							totalTzw = totalTzw + Integer.parseInt(T_zw_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(17);
					        cell.setCellValue(Integer.parseInt(T_zw_cnt.get(index - 1), 10));//T脏污
						}
				        
						if (!Util.isEmptyString(T_ly_cnt.get(index - 1)) && Integer.parseInt(T_ly_cnt.get(index - 1), 10) != 0) {
							totalTly = totalTly + Integer.parseInt(T_ly_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(18);
					        cell.setCellValue(Integer.parseInt(T_ly_cnt.get(index - 1), 10));//T轮印
						}
				        
						if (!Util.isEmptyString(T_other.get(index - 1)) && Integer.parseInt(T_other.get(index - 1), 10) != 0) {
							totalTother = totalTother + Integer.parseInt(T_other.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(19);
					        cell.setCellValue(Integer.parseInt(T_other.get(index - 1), 10));//其他不良
						}
				        
						if(!Util.isEmptyString(remark.get(index - 1))){
							cell = sheet.getRow(j+8).getCell(20);
					        cell.setCellValue(remark.get(index - 1));
						}

					}
				}

				//007厦门天马从38开始合计
				cell = sheet.getRow(n).getCell(2);
		        cell.setCellValue(totalyjyc);
		        cell = sheet.getRow(n).getCell(3);
		        cell.setCellValue(totalsy);
		        cell = sheet.getRow(n).getCell(4);
		        cell.setCellValue(totalChs);
		        cell = sheet.getRow(n).getCell(5);
		        cell.setCellValue(totalCad);
		        cell = sheet.getRow(n).getCell(6);
		        cell.setCellValue(totalCtd);
		        cell = sheet.getRow(n).getCell(7);
		        cell.setCellValue(totalCshbj);
		        cell = sheet.getRow(n).getCell(8);
		        cell.setCellValue(totalCps);
		        cell = sheet.getRow(n).getCell(9);
		        cell.setCellValue(totalCzw);
		        cell = sheet.getRow(n).getCell(10);
		        cell.setCellValue(totalCly);
		        cell = sheet.getRow(n).getCell(11);
		        cell.setCellValue(totalCother);
		        cell = sheet.getRow(n).getCell(12);
		        cell.setCellValue(totalThs);
		        cell = sheet.getRow(n).getCell(13);
		        cell.setCellValue(totalTad);
		        cell = sheet.getRow(n).getCell(14);
		        cell.setCellValue(totalTtd);
		        cell = sheet.getRow(n).getCell(15);
		        cell.setCellValue(totalTshbj);
		        cell = sheet.getRow(n).getCell(16);
		        cell.setCellValue(totalTps);
		        cell = sheet.getRow(n).getCell(17);
		        cell.setCellValue(totalTzw);
		        cell = sheet.getRow(n).getCell(18);
		        cell.setCellValue(totalTly);
		        cell = sheet.getRow(n).getCell(19);
		        cell.setCellValue(totalTother);
		        cell = sheet.getRow(n).getCell(20);
		        cell.setCellValue(shipBoxId);
			}
			String filename = excel.creatFile();
			FileOutputStream fileOut = new FileOutputStream(filename);  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
			excel.printExcel(printer,filename);
		}catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}
	
	/**
	 * for 华南客户出货信息表
	 * @param printer
	 * @param str
	 */
	public void PrintJBorDMQAHN(final String printer ,final String str) {
		try {
			PrintQAForHN printData = new PrintQAForHN();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			
			double stdQty = printData.getStdQty();
			String procId = printData.getProcId();
			String cusId = printData.getCusId();
			String woId = printData.getWoId();
			String actSoId = printData.getActSoId();
			String soId = printData.getSoId();
			String boxId = printData.getBoxId();
			String prdCnt = printData.getPrdCnt();
			String toThickness = printData.getToThickness();
			String totalModelCnt = printData.getTotalModelCnt();
			String modelCnt = printData.getModelCnt();
			String mdlId = printData.getMdlId();
			String whole_def_cnt = printData.getWhole_def_cnt();
			String whole_yield = printData.getWhole_yield();
			List<String> prdId = printData.getPrdAry();
			List<String> l_hnbl_cnt = printData.getlHnblAry();
			List<String> l_llhx_cnt = printData.getlLlhxAry();
			List<String> l_atd_cnt = printData.getlAtdAry();
			List<String> l_ps_cnt = printData.getlPsAry();
			List<String> l_lw_cnt = printData.getlLwAry();
			List<String> l_hs_cnt = printData.getlHsAry();
			List<String> l_zw_cnt = printData.getlZwAry();
			List<String> l_other = printData.getlOther();
			List<String> z_d_atd_cnt = printData.getZdAtdAry();
			List<String> z_d_hs_cnt = printData.getZdHsAry();
			List<String> z_d_ssbj_cnt = printData.getZdSsbjAry();
			List<String> z_d_zw_cnt = printData.getZdZwAry();
			List<String> z_d_ly_cnt = printData.getZdLyAry();
			List<String> z_ps_cnt = printData.getzPsAry();
			List<String> z_lw_cnt = printData.getzLwAry();
			List<String> z_ly_cnt = printData.getzLyAry();
			List<String> z_ls_cnt = printData.getzLsAry();
			List<String> z_fs_cnt = printData.getzFsAry();
			List<String> z_other = printData.getzOther();
			List<String> status = printData.getStatusAry();
			List<String> remark = printData.getRemarkAry();
			String checkUser = printData.getCheckUser();
			String printTyp = printData.getPrintTyp();
			String dateString = JackUtil.getCurTime();
			int loopCnt = (int) Math.ceil(stdQty / 25);
			
			String procTyp = "";
			if("JBQA".equals(procId)){
				procTyp = "JB";
			}else{
				procTyp = "DM";
			}
			
			Print excel = new Print(boxId,dateString,printTyp,"6",loopCnt,procTyp,cusId,woId);
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
			
			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
		        //读取了workbook内sheet内容  
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1))); 
				
				int totalLhnbl = 0;
				int totalLllhx = 0;
				int totalLatd = 0;
				int totalLps = 0;
				int totalLlw = 0;
				int totalLhs = 0;
				int totalLzw = 0;
				int totalLother = 0;
				int totalZDatd = 0;
				int totalZDhs = 0;
				int totalZDssbj = 0;
				int totalZDzw = 0;
				int totalZDly = 0;
				int totalZps = 0;
				int totalZlw = 0;
				int totalZly = 0;
				int totalZls = 0;
				int totalZfs = 0;
				int totalZother = 0;

				//第一行
		        HSSFCell cell = sheet.getRow(3).getCell(1);
		        cell.setCellValue(cusId);
		        cell = sheet.getRow(3).getCell(3);
		        cell.setCellValue(toThickness + "mm");
		        cell = sheet.getRow(3).getCell(9);
		        cell.setCellValue(boxId);
		        cell = sheet.getRow(3).getCell(14);
		        cell.setCellValue(prdCnt);
		        cell = sheet.getRow(3).getCell(16);
		        cell.setCellValue(totalModelCnt);
		        cell = sheet.getRow(3).getCell(19);
		        cell.setCellValue(whole_def_cnt);
		        cell = sheet.getRow(3).getCell(21);
		        cell.setCellValue("检验员：" + checkUser);
	            //第二行
		        cell = sheet.getRow(4).getCell(1);
		        cell.setCellValue(mdlId);
		        cell = sheet.getRow(4).getCell(3);
		        cell.setCellValue(actSoId);
		        cell = sheet.getRow(4).getCell(9);
		        cell.setCellValue(JackUtil.getCurDate());
		        cell = sheet.getRow(4).getCell(14);
		        cell.setCellValue(modelCnt);
		        cell = sheet.getRow(4).getCell(16);
		        cell.setCellValue(woId);
		        cell = sheet.getRow(4).getCell(19);
		        cell.setCellValue(whole_yield + "%");

				for (j = 0; j < 25; j++, index++) {
					if (index <= stdQty) {
						cell = sheet.getRow(j+8).getCell(0);
				        cell.setCellValue(index);
				        
				        if(!Util.isEmptyString(prdId.get(index - 1))){
							cell = sheet.getRow(j+8).getCell(1);
					        cell.setCellValue(prdId.get(index - 1));
						}
						
						if(!Util.isEmptyString(status.get(index - 1))){
							cell = sheet.getRow(j+8).getCell(2);
					        cell.setCellValue(status.get(index - 1));
						}
						
						if (!Util.isEmptyString(l_hnbl_cnt.get(index - 1)) && Integer.parseInt(l_hnbl_cnt.get(index - 1), 10) != 0) {
							totalLhnbl = totalLhnbl + Integer.parseInt(l_hnbl_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(3);
					        cell.setCellValue(Integer.parseInt(l_hnbl_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_llhx_cnt.get(index - 1)) && Integer.parseInt(l_llhx_cnt.get(index - 1), 10) != 0) {
							totalLllhx = totalLllhx + Integer.parseInt(l_llhx_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(4);
					        cell.setCellValue(Integer.parseInt(l_llhx_cnt.get(index - 1), 10));
						}

						if (!Util.isEmptyString(l_atd_cnt.get(index - 1)) && Integer.parseInt(l_atd_cnt.get(index - 1), 10) != 0) {
							totalLatd = totalLatd + Integer.parseInt(l_atd_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(5);
					        cell.setCellValue(Integer.parseInt(l_atd_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(l_ps_cnt.get(index - 1)) && Integer.parseInt(l_ps_cnt.get(index - 1), 10) != 0) {
							totalLps = totalLps + Integer.parseInt(l_ps_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(6);
					        cell.setCellValue(Integer.parseInt(l_ps_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_lw_cnt.get(index - 1)) && Integer.parseInt(l_lw_cnt.get(index - 1), 10) != 0) {
							totalLlw = totalLlw + Integer.parseInt(l_lw_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(7);
					        cell.setCellValue(Integer.parseInt(l_lw_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_hs_cnt.get(index - 1)) && Integer.parseInt(l_hs_cnt.get(index - 1), 10) != 0) {
							totalLhs = totalLhs + Integer.parseInt(l_hs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(8);
					        cell.setCellValue(Integer.parseInt(l_hs_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_zw_cnt.get(index - 1)) && Integer.parseInt(l_zw_cnt.get(index - 1), 10) != 0) {
							totalLzw = totalLzw + Integer.parseInt(l_zw_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(9);
					        cell.setCellValue(Integer.parseInt(l_zw_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_other.get(index - 1)) && Integer.parseInt(l_other.get(index - 1), 10) != 0) {
							totalLother = totalLother + Integer.parseInt(l_other.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(10);
					        cell.setCellValue(Integer.parseInt(l_other.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_d_atd_cnt.get(index - 1)) && Integer.parseInt(z_d_atd_cnt.get(index - 1), 10) != 0) {
							totalZDatd = totalZDatd + Integer.parseInt(z_d_atd_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(11);
					        cell.setCellValue(Integer.parseInt(z_d_atd_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_d_hs_cnt.get(index - 1)) && Integer.parseInt(z_d_hs_cnt.get(index - 1), 10) != 0) {
							totalZDhs = totalZDhs + Integer.parseInt(z_d_hs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(12);
					        cell.setCellValue(Integer.parseInt(z_d_hs_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_d_ssbj_cnt.get(index - 1)) && Integer.parseInt(z_d_ssbj_cnt.get(index - 1), 10) != 0) {
							totalZDssbj = totalZDssbj + Integer.parseInt(z_d_ssbj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(13);
					        cell.setCellValue(Integer.parseInt(z_d_ssbj_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(z_d_zw_cnt.get(index - 1)) && Integer.parseInt(z_d_zw_cnt.get(index - 1), 10) != 0) {
							totalZDzw = totalZDzw + Integer.parseInt(z_d_zw_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(14);
					        cell.setCellValue(Integer.parseInt(z_d_zw_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_d_ly_cnt.get(index - 1)) && Integer.parseInt(z_d_ly_cnt.get(index - 1), 10) != 0) {
							totalZDly = totalZDly + Integer.parseInt(z_d_ly_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(15);
					        cell.setCellValue(Integer.parseInt(z_d_ly_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(z_ps_cnt.get(index - 1)) && Integer.parseInt(z_ps_cnt.get(index - 1), 10) != 0) {
							totalZps = totalZps + Integer.parseInt(z_ps_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(16);
					        cell.setCellValue(Integer.parseInt(z_ps_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(z_lw_cnt.get(index - 1)) && Integer.parseInt(z_lw_cnt.get(index - 1), 10) != 0) {
							totalZlw = totalZlw + Integer.parseInt(z_lw_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(17);
					        cell.setCellValue(Integer.parseInt(z_lw_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(z_ly_cnt.get(index - 1)) && Integer.parseInt(z_ly_cnt.get(index - 1), 10) != 0) {
							totalZly = totalZly + Integer.parseInt(z_ly_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(18);
					        cell.setCellValue(Integer.parseInt(z_ly_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_ls_cnt.get(index - 1)) && Integer.parseInt(z_ls_cnt.get(index - 1), 10) != 0) {
							totalZls = totalZls + Integer.parseInt(z_ls_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(19);
					        cell.setCellValue(Integer.parseInt(z_ls_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_fs_cnt.get(index - 1)) && Integer.parseInt(z_fs_cnt.get(index - 1), 10) != 0) {
							totalZfs = totalZfs + Integer.parseInt(z_fs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(20);
					        cell.setCellValue(Integer.parseInt(z_fs_cnt.get(index - 1), 10));
						}	
				        
						if (!Util.isEmptyString(z_other.get(index - 1)) && Integer.parseInt(z_other.get(index - 1), 10) != 0) {
							totalZother = totalZother + Integer.parseInt(z_other.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(21);
					        cell.setCellValue(Integer.parseInt(z_other.get(index - 1), 10));
						}	
				        
						if(!Util.isEmptyString(remark.get(index - 1))){
							cell = sheet.getRow(j+8).getCell(22);
					        cell.setCellValue(remark.get(index - 1));
						}
					}
				}

				cell = sheet.getRow(33).getCell(3);
		        cell.setCellValue(totalLhnbl);
		        cell = sheet.getRow(33).getCell(4);
		        cell.setCellValue(totalLllhx);
		        cell = sheet.getRow(33).getCell(5);
		        cell.setCellValue(totalLatd);
		        cell = sheet.getRow(33).getCell(6);
		        cell.setCellValue(totalLps);
		        cell = sheet.getRow(33).getCell(7);
		        cell.setCellValue(totalLlw);
		        cell = sheet.getRow(33).getCell(8);
		        cell.setCellValue(totalLhs);
		        cell = sheet.getRow(33).getCell(9);
		        cell.setCellValue(totalLzw);
		        cell = sheet.getRow(33).getCell(10);
		        cell.setCellValue(totalLother);
		        cell = sheet.getRow(33).getCell(11);
		        cell.setCellValue(totalZDatd);
		        cell = sheet.getRow(33).getCell(12);
		        cell.setCellValue(totalZDhs);
		        cell = sheet.getRow(33).getCell(13);
		        cell.setCellValue(totalZDssbj);
		        cell = sheet.getRow(33).getCell(14);
		        cell.setCellValue(totalZDzw);
		        cell = sheet.getRow(33).getCell(15);
		        cell.setCellValue(totalZDly);
		        cell = sheet.getRow(33).getCell(16);
		        cell.setCellValue(totalZps);
		        cell = sheet.getRow(33).getCell(17);
		        cell.setCellValue(totalZlw);
		        cell = sheet.getRow(33).getCell(18);
		        cell.setCellValue(totalZly);
		        cell = sheet.getRow(33).getCell(19);
		        cell.setCellValue(totalZls);
		        cell = sheet.getRow(33).getCell(20);
		        cell.setCellValue(totalZfs);
		        cell = sheet.getRow(33).getCell(21);
		        cell.setCellValue(totalZother);
			}
			String filename = excel.creatFile();
			FileOutputStream fileOut = new FileOutputStream(filename);  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
	        excel.printExcel(printer,filename);
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}
	
	/**
	 * for 115客户出货信息表
	 * @param printer
	 * @param str
	 */
	public void PrintJBorDMQA115(final String printer ,final String str) {
		try {
			PrintQAFor115 printData = new PrintQAFor115();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			
			double stdQty = printData.getStdQty();
			String procId = printData.getProcId();
			String cusId = printData.getCusId();
			String boxId = printData.getBoxId();
			String prdCnt = printData.getPrdCnt();
			String toThickness = printData.getToThickness();
			String mdlId = printData.getMdlId();
			List<String> prdId = printData.getPrdAry();
			List<String> mtrlBox = printData.getMtrlBoxAry();
			List<String> l_llhx_cnt = printData.getlLlhxAry();
			List<String> l_yjyc_cnt = printData.getlYjycAry();
			List<String> l_atd_cnt = printData.getlAtdAry();
			List<String> l_pl_cnt = printData.getlPlAry();
			List<String> l_hs_cnt = printData.getlHsAry();
			List<String> l_wj_cnt = printData.getlWjAry();
			List<String> l_other_cnt = printData.getlOtherAry();
			List<String> lCnt = printData.getlCntAry();
			List<String> z_hs_cnt = printData.getzHsAry();
			List<String> z_atd_cnt = printData.getzAtdAry();
			List<String> z_ssbj_cnt = printData.getzSsbjAry();
			List<String> z_lw_cnt = printData.getzLwAry();
			List<String> z_ps_cnt = printData.getzPsAry();
			List<String> z_ly_cnt = printData.getzLyAry();
			List<String> z_wj_cnt = printData.getzWjAry();
			List<String> z_pit_cnt = printData.getzPitAry();
			List<String> zCnt = printData.getzCntAry();
			List<String> status = printData.getStatusAry();
			List<String> remark = printData.getRemarkAry();
			String woId = printData.getWoId();
			String actSoId = printData.getActSoId();
			String printTyp = printData.getPrintTyp();
			String dateString = JackUtil.getCurTime();
			int loopCnt = (int) Math.ceil(stdQty / 20);
			
			String procTyp = "";
			if(procId.equals("JBQA")){
				procTyp = "JB";
			}else{
				procTyp = "DM";
			}
			
			Print excel = new Print(boxId,dateString,printTyp,"5",loopCnt,procTyp,cusId,woId);
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
			
			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
		        //读取了workbook内sheet内容  
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1)));
				
				int totallDef1 = 0;
				int totallDef2 = 0;
				int totallDef3 = 0;
				int totallDef4 = 0;
				int totallDef5 = 0;
				int totallDef6 = 0;
				int totallDef7 = 0;
				int totallDef = 0;
				int totalzDef1 = 0;
				int totalzDef2 = 0;
				int totalzDef3 = 0;
				int totalzDef4 = 0;
				int totalzDef5 = 0;
				int totalzDef6 = 0;
				int totalzDef7 = 0;
				int totalzDef8 = 0;
				int totalzDef = 0;

				//第一行
		        HSSFCell cell = sheet.getRow(3).getCell(1);
		        cell.setCellValue(cusId);
		        cell = sheet.getRow(3).getCell(5);
		        cell.setCellValue(actSoId);
		        cell = sheet.getRow(3).getCell(14);
		        cell.setCellValue(boxId);
		        cell = sheet.getRow(3).getCell(22);
		        cell.setCellValue(toThickness + "mm");
		        
	            //第二行
		        cell = sheet.getRow(4).getCell(1);
		        cell.setCellValue(prdCnt);
		        cell = sheet.getRow(4).getCell(5);
		        cell.setCellValue(JackUtil.getCurDate());
		        cell = sheet.getRow(4).getCell(22);
		        cell.setCellValue(mdlId);

				for (j = 0; j < 20; j++, index++) {
					if (index <= stdQty) {
						cell = sheet.getRow(j+7).getCell(0);
				        cell.setCellValue(index);
				        
				        if(!Util.isEmptyString(prdId.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(1);
					        cell.setCellValue(prdId.get(index - 1));
						}
						
						if(!Util.isEmptyString(mtrlBox.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(2);
					        cell.setCellValue(mtrlBox.get(index - 1));
						}
						
						if(!Util.isEmptyString(status.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(3);
					        cell.setCellValue(status.get(index - 1));
						}
						
						if (!Util.isEmptyString(l_llhx_cnt.get(index - 1)) && Integer.parseInt(l_llhx_cnt.get(index - 1), 10) != 0) {
							totallDef1 = totallDef1 + Integer.parseInt(l_llhx_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(4);
					        cell.setCellValue(Integer.parseInt(l_llhx_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_yjyc_cnt.get(index - 1)) && Integer.parseInt(l_yjyc_cnt.get(index - 1), 10) != 0) {
							totallDef2 = totallDef2 + Integer.parseInt(l_yjyc_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(5);
					        cell.setCellValue(Integer.parseInt(l_yjyc_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_atd_cnt.get(index - 1)) && Integer.parseInt(l_atd_cnt.get(index - 1), 10) != 0) {
							totallDef3 = totallDef3 + Integer.parseInt(l_atd_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(6);
					        cell.setCellValue(Integer.parseInt(l_atd_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_pl_cnt.get(index - 1)) && Integer.parseInt(l_pl_cnt.get(index - 1), 10) != 0) {
							totallDef4 = totallDef4 + Integer.parseInt(l_pl_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(7);
					        cell.setCellValue(Integer.parseInt(l_pl_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_hs_cnt.get(index - 1)) && Integer.parseInt(l_hs_cnt.get(index - 1), 10) != 0) {
							totallDef5 = totallDef5 + Integer.parseInt(l_hs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(8);
					        cell.setCellValue(Integer.parseInt(l_hs_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_wj_cnt.get(index - 1)) && Integer.parseInt(l_wj_cnt.get(index - 1), 10) != 0) {
							totallDef6 = totallDef6 + Integer.parseInt(l_wj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(9);
					        cell.setCellValue(Integer.parseInt(l_wj_cnt.get(index - 1), 10));
						}

						if (!Util.isEmptyString(l_other_cnt.get(index - 1)) && Integer.parseInt(l_other_cnt.get(index - 1), 10) != 0) {
							totallDef7 = totallDef7 + Integer.parseInt(l_other_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(10);
					        cell.setCellValue(Integer.parseInt(l_other_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(lCnt.get(index - 1))) {
							totallDef = totallDef + Integer.parseInt(lCnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(11);
					        cell.setCellValue(Integer.parseInt(lCnt.get(index - 1), 10));
						}
						if (!Util.isEmptyString(z_hs_cnt.get(index - 1)) && Integer.parseInt(z_hs_cnt.get(index - 1), 10) != 0) {
							totalzDef1 = totalzDef1 + Integer.parseInt(z_hs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(12);
					        cell.setCellValue(Integer.parseInt(z_hs_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(z_atd_cnt.get(index - 1)) && Integer.parseInt(z_atd_cnt.get(index - 1), 10) != 0) {
							totalzDef2 = totalzDef2 + Integer.parseInt(z_atd_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(13);
					        cell.setCellValue(Integer.parseInt(z_atd_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(z_ssbj_cnt.get(index - 1)) && Integer.parseInt(z_ssbj_cnt.get(index - 1), 10) != 0) {
							totalzDef3 = totalzDef3 + Integer.parseInt(z_ssbj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(14);
					        cell.setCellValue(Integer.parseInt(z_ssbj_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_lw_cnt.get(index - 1)) && Integer.parseInt(z_lw_cnt.get(index - 1), 10) != 0) {
							totalzDef4 = totalzDef4 + Integer.parseInt(z_lw_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(15);
					        cell.setCellValue(Integer.parseInt(z_lw_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_ps_cnt.get(index - 1)) && Integer.parseInt(z_ps_cnt.get(index - 1), 10) != 0) {
							totalzDef5 = totalzDef5 + Integer.parseInt(z_ps_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(16);
					        cell.setCellValue(Integer.parseInt(z_ps_cnt.get(index - 1), 10));
						}

						if (!Util.isEmptyString(z_ly_cnt.get(index - 1)) && Integer.parseInt(z_ly_cnt.get(index - 1), 10) != 0) {
							totalzDef6 = totalzDef6 + Integer.parseInt(z_ly_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(17);
					        cell.setCellValue(Integer.parseInt(z_ly_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(z_wj_cnt.get(index - 1)) && Integer.parseInt(z_wj_cnt.get(index - 1), 10) != 0) {
							totalzDef7 = totalzDef7 + Integer.parseInt(z_wj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(18);
					        cell.setCellValue(Integer.parseInt(z_wj_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(z_pit_cnt.get(index - 1)) && Integer.parseInt(z_pit_cnt.get(index - 1), 10) != 0) {
							totalzDef8 = totalzDef8 + Integer.parseInt(z_pit_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(19);
					        cell.setCellValue(Integer.parseInt(z_pit_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(zCnt.get(index - 1))) {
							totalzDef = totalzDef + Integer.parseInt(zCnt.get(index - 1), 10);
							cell = sheet.getRow(j+7).getCell(20);
					        cell.setCellValue(Integer.parseInt(zCnt.get(index - 1), 10));
						}
						
						if(!Util.isEmptyString(remark.get(index - 1))){
							cell = sheet.getRow(j+7).getCell(21);
					        cell.setCellValue(remark.get(index - 1));
						}
					}
				}

				cell = sheet.getRow(27).getCell(4);
		        cell.setCellValue(totallDef1);
		        cell = sheet.getRow(27).getCell(5);
		        cell.setCellValue(totallDef2);
		        cell = sheet.getRow(27).getCell(6);
		        cell.setCellValue(totallDef3);
		        cell = sheet.getRow(27).getCell(7);
		        cell.setCellValue(totallDef4);
		        cell = sheet.getRow(27).getCell(8);
		        cell.setCellValue(totallDef5);
		        cell = sheet.getRow(27).getCell(9);
		        cell.setCellValue(totallDef6);
		        cell = sheet.getRow(27).getCell(10);
		        cell.setCellValue(totallDef7);
		        cell = sheet.getRow(27).getCell(11);
		        cell.setCellValue(totallDef);
		        cell = sheet.getRow(27).getCell(12);
		        cell.setCellValue(totalzDef1);
		        cell = sheet.getRow(27).getCell(13);
		        cell.setCellValue(totalzDef2);
		        cell = sheet.getRow(27).getCell(14);
		        cell.setCellValue(totalzDef3);
		        cell = sheet.getRow(27).getCell(15);
		        cell.setCellValue(totalzDef4);
		        cell = sheet.getRow(27).getCell(16);
		        cell.setCellValue(totalzDef5);
		        cell = sheet.getRow(27).getCell(17);
		        cell.setCellValue(totalzDef6);
		        cell = sheet.getRow(27).getCell(18);
		        cell.setCellValue(totalzDef7);
		        cell = sheet.getRow(27).getCell(19);
		        cell.setCellValue(totalzDef8);
		        cell = sheet.getRow(27).getCell(20);
		        cell.setCellValue(totalzDef);  
			}
			String filename = excel.creatFile();
			FileOutputStream fileOut = new FileOutputStream(filename);  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
	        excel.printExcel(printer,filename);
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}

	/**
	 * for 华南客户出货信息表
	 * @param printer
	 * @param str
	 */
	public void PrintJBorDMQA168(final String printer ,final String str) {
		try {
			PrintQAFor168 printData = new PrintQAFor168();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			
			double stdQty = printData.getStdQty();
			String procId = printData.getProcId();
			String cusId = printData.getCusId();
			String woId = printData.getWoId();
			String actSoId = printData.getActSoId();
			String soId = printData.getSoId();
			String boxId = printData.getBoxId();
			String prdCnt = printData.getPrdCnt();
			String toThickness = printData.getToThickness();
			String totalModelCnt = printData.getTotalModelCnt();
			String modelCnt = printData.getModelCnt();
			String mdlId = printData.getMdlId();
			String whole_def_cnt = printData.getWhole_def_cnt();
			String whole_yield = printData.getWhole_yield();
			List<String> prdId = printData.getPrdAry();
			List<String> l_hnbl_cnt = printData.getlHnblAry();
			List<String> l_llhx_cnt = printData.getlLlhxAry();
			List<String> l_ysbj_cnt = printData.getlYsbjAry();
			List<String> l_ps_cnt = printData.getlPsAry();
			List<String> l_lw_cnt = printData.getlLwAry();
			List<String> l_gs_cnt = printData.getlGsAry();
			List<String> l_ad_cnt = printData.getlAdAry();
			List<String> l_td_cnt = printData.getlTdAry();
			List<String> l_wj_cnt = printData.getlWjAry();
			List<String> l_other = printData.getlOther();
			List<String> c_td_cnt = printData.getcTdAry();
			List<String> c_gs_cnt = printData.getcGsAry();
			List<String> c_ssbj_cnt = printData.getcSsbjAry();
			List<String> c_zw_cnt = printData.getcZwAry();
			List<String> c_pr_cnt = printData.getcPrAry();
			List<String> c_ly_cnt = printData.getcLyAry();
			List<String> c_ps_cnt = printData.getcPsAry();
			List<String> c_fs_cnt = printData.getcFsAry();
			List<String> c_other = printData.getcOther();
			List<String> t_td_cnt = printData.gettTdAry();
			List<String> t_gs_cnt = printData.gettGsAry();
			List<String> t_ssbj_cnt = printData.gettSsbjAry();
			List<String> t_zw_cnt = printData.gettZwAry();
			List<String> t_ly_cnt = printData.gettLyAry();
			List<String> t_ps_cnt = printData.gettPsAry();
			List<String> t_fs_cnt = printData.gettFsAry();
			List<String> t_other = printData.gettOther();
			List<String> status = printData.getStatusAry();
			List<String> remark = printData.getRemarkAry();
			String checkUser = printData.getCheckUser();
			String printTyp = printData.getPrintTyp();
			String dateString = JackUtil.getCurTime();
			int loopCnt = (int) Math.ceil(stdQty / 25);
			
			String procTyp = "";
			if(procId.equals("JBQA")){
				procTyp = "JB";
			}else{
				procTyp = "DM";
			}
			
			Print excel = new Print(boxId,dateString,printTyp,"C",loopCnt,procTyp,cusId,woId);
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
			
			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
		        //读取了workbook内sheet内容  
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1))); 
				
				int totalLhnbl = 0;
				int totalLllhx = 0;
				int totalLysbj = 0;
				int totalLps = 0;
				int totalLlw = 0;
				int totalLgs = 0;
				int totalLad = 0;
				int totalLtd = 0;
				int totalLwj = 0;
				int totalLother = 0;
				int totalCtd = 0;
				int totalCgs = 0;
				int totalCssbj = 0;
				int totalCzw = 0;
				int totalCpr = 0;
				int totalCly = 0;
				int totalCps = 0;
				int totalCfs = 0;
				int totalCother = 0;
				int totalTtd = 0;
				int totalTgs = 0;
				int totalTssbj = 0;
				int totalTzw = 0;
				int totalTly = 0;
				int totalTps = 0;
				int totalTfs = 0;
				int totalTother = 0;
				
				//第一行
		        HSSFCell cell = sheet.getRow(3).getCell(1);
		        cell.setCellValue(cusId);
		        cell = sheet.getRow(3).getCell(3);
		        cell.setCellValue(toThickness + "mm");
		        cell = sheet.getRow(3).getCell(10);
		        cell.setCellValue(boxId);
		        cell = sheet.getRow(3).getCell(16);
		        cell.setCellValue(prdCnt);
		        cell = sheet.getRow(3).getCell(21);
		        cell.setCellValue(totalModelCnt);
		        cell = sheet.getRow(3).getCell(27);
		        cell.setCellValue(whole_def_cnt);
		        cell = sheet.getRow(3).getCell(29);
		        cell.setCellValue("检验员：" + checkUser);
	            //第二行
		        cell = sheet.getRow(4).getCell(1);
		        cell.setCellValue(mdlId);
		        cell = sheet.getRow(4).getCell(3);
		        cell.setCellValue(actSoId);
		        cell = sheet.getRow(4).getCell(10);
		        cell.setCellValue(JackUtil.getCurDate());
		        cell = sheet.getRow(4).getCell(16);
		        cell.setCellValue(modelCnt);
		        cell = sheet.getRow(4).getCell(21);
		        cell.setCellValue(woId);
		        cell = sheet.getRow(4).getCell(27);
		        cell.setCellValue(whole_yield + "%");

				for (j = 0; j < 25; j++, index++) {
					if (index <= stdQty) {
						cell = sheet.getRow(j+8).getCell(0);
				        cell.setCellValue(index);
				        
				        if(!Util.isEmptyString(prdId.get(index - 1))){
							cell = sheet.getRow(j+8).getCell(1);
					        cell.setCellValue(prdId.get(index - 1));
						}
						
						if(!Util.isEmptyString(status.get(index - 1))){
							cell = sheet.getRow(j+8).getCell(2);
					        cell.setCellValue(status.get(index - 1));
						}
						
						if (!Util.isEmptyString(l_hnbl_cnt.get(index - 1)) && Integer.parseInt(l_hnbl_cnt.get(index - 1), 10) != 0) {
							totalLhnbl = totalLhnbl + Integer.parseInt(l_hnbl_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(3);
					        cell.setCellValue(Integer.parseInt(l_hnbl_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_llhx_cnt.get(index - 1)) && Integer.parseInt(l_llhx_cnt.get(index - 1), 10) != 0) {
							totalLllhx = totalLllhx + Integer.parseInt(l_llhx_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(4);
					        cell.setCellValue(Integer.parseInt(l_llhx_cnt.get(index - 1), 10));
						}

						if (!Util.isEmptyString(l_ysbj_cnt.get(index - 1)) && Integer.parseInt(l_ysbj_cnt.get(index - 1), 10) != 0) {
							totalLysbj = totalLysbj + Integer.parseInt(l_ysbj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(5);
					        cell.setCellValue(Integer.parseInt(l_ysbj_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(l_ps_cnt.get(index - 1)) && Integer.parseInt(l_ps_cnt.get(index - 1), 10) != 0) {
							totalLps = totalLps + Integer.parseInt(l_ps_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(6);
					        cell.setCellValue(Integer.parseInt(l_ps_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_lw_cnt.get(index - 1)) && Integer.parseInt(l_lw_cnt.get(index - 1), 10) != 0) {
							totalLlw = totalLlw + Integer.parseInt(l_lw_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(7);
					        cell.setCellValue(Integer.parseInt(l_lw_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_gs_cnt.get(index - 1)) && Integer.parseInt(l_gs_cnt.get(index - 1), 10) != 0) {
							totalLgs = totalLgs + Integer.parseInt(l_gs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(8);
					        cell.setCellValue(Integer.parseInt(l_gs_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(l_ad_cnt.get(index - 1)) && Integer.parseInt(l_ad_cnt.get(index - 1), 10) != 0) {
							totalLad = totalLad + Integer.parseInt(l_ad_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(9);
					        cell.setCellValue(Integer.parseInt(l_ad_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(l_td_cnt.get(index - 1)) && Integer.parseInt(l_td_cnt.get(index - 1), 10) != 0) {
                            totalLtd = totalLtd + Integer.parseInt(l_td_cnt.get(index - 1), 10);
                            cell = sheet.getRow(j+8).getCell(10);
                            cell.setCellValue(Integer.parseInt(l_td_cnt.get(index - 1), 10));
                        }
						
						if (!Util.isEmptyString(l_wj_cnt.get(index - 1)) && Integer.parseInt(l_wj_cnt.get(index - 1), 10) != 0) {
						  totalLwj = totalLwj + Integer.parseInt(l_wj_cnt.get(index - 1), 10);
						  cell = sheet.getRow(j+8).getCell(11);
						  cell.setCellValue(Integer.parseInt(l_wj_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(l_other.get(index - 1)) && Integer.parseInt(l_other.get(index - 1), 10) != 0) {
							totalLother = totalLother + Integer.parseInt(l_other.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(12);
					        cell.setCellValue(Integer.parseInt(l_other.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(c_td_cnt.get(index - 1)) && Integer.parseInt(c_td_cnt.get(index - 1), 10) != 0) {
							totalCtd = totalCtd + Integer.parseInt(c_td_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(13);
					        cell.setCellValue(Integer.parseInt(c_td_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(c_gs_cnt.get(index - 1)) && Integer.parseInt(c_gs_cnt.get(index - 1), 10) != 0) {
							totalCgs = totalCgs + Integer.parseInt(c_gs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(14);
					        cell.setCellValue(Integer.parseInt(c_gs_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(c_ssbj_cnt.get(index - 1)) && Integer.parseInt(c_ssbj_cnt.get(index - 1), 10) != 0) {
							totalCssbj = totalCssbj + Integer.parseInt(c_ssbj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(15);
					        cell.setCellValue(Integer.parseInt(c_ssbj_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(c_zw_cnt.get(index - 1)) && Integer.parseInt(c_zw_cnt.get(index - 1), 10) != 0) {
							totalCzw = totalCzw + Integer.parseInt(c_zw_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(16);
					        cell.setCellValue(Integer.parseInt(c_zw_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(c_pr_cnt.get(index - 1)) && Integer.parseInt(c_pr_cnt.get(index - 1), 10) != 0) {
						  totalCpr = totalCpr + Integer.parseInt(c_pr_cnt.get(index - 1), 10);
						  cell = sheet.getRow(j+8).getCell(17);
						  cell.setCellValue(Integer.parseInt(c_pr_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(c_ly_cnt.get(index - 1)) && Integer.parseInt(c_ly_cnt.get(index - 1), 10) != 0) {
							totalCly = totalCly + Integer.parseInt(c_ly_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(18);
					        cell.setCellValue(Integer.parseInt(c_ly_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(c_ps_cnt.get(index - 1)) && Integer.parseInt(c_ps_cnt.get(index - 1), 10) != 0) {
							totalCps = totalCps + Integer.parseInt(c_ps_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(19);
					        cell.setCellValue(Integer.parseInt(c_ps_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(c_fs_cnt.get(index - 1)) && Integer.parseInt(c_fs_cnt.get(index - 1), 10) != 0) {
							totalCfs = totalCfs + Integer.parseInt(c_fs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(20);
					        cell.setCellValue(Integer.parseInt(c_fs_cnt.get(index - 1), 10));
						}
						
						if (!Util.isEmptyString(c_other.get(index - 1)) && Integer.parseInt(c_other.get(index - 1), 10) != 0) {
							totalCother = totalCother + Integer.parseInt(c_other.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(21);
					        cell.setCellValue(Integer.parseInt(c_other.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(t_td_cnt.get(index - 1)) && Integer.parseInt(t_td_cnt.get(index - 1), 10) != 0) {
							totalTtd = totalTtd + Integer.parseInt(t_td_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(22);
					        cell.setCellValue(Integer.parseInt(t_td_cnt.get(index - 1), 10));
						}
				        
						if (!Util.isEmptyString(t_gs_cnt.get(index - 1)) && Integer.parseInt(t_gs_cnt.get(index - 1), 10) != 0) {
							totalTgs = totalTgs + Integer.parseInt(t_gs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(23);
					        cell.setCellValue(Integer.parseInt(t_gs_cnt.get(index - 1), 10));
						}	
				        
						if (!Util.isEmptyString(t_ssbj_cnt.get(index - 1)) && Integer.parseInt(t_ssbj_cnt.get(index - 1), 10) != 0) {
							totalTssbj = totalTssbj + Integer.parseInt(t_ssbj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(24);
					        cell.setCellValue(Integer.parseInt(t_ssbj_cnt.get(index - 1), 10));
						}	
				        
						if (!Util.isEmptyString(t_zw_cnt.get(index - 1)) && Integer.parseInt(t_zw_cnt.get(index - 1), 10) != 0) {
							totalTzw = totalTzw + Integer.parseInt(t_zw_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(25);
					        cell.setCellValue(Integer.parseInt(t_zw_cnt.get(index - 1), 10));
						}	
						
						if (!Util.isEmptyString(t_ly_cnt.get(index - 1)) && Integer.parseInt(t_ly_cnt.get(index - 1), 10) != 0) {
							totalTly = totalTly + Integer.parseInt(t_ly_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(26);
					        cell.setCellValue(Integer.parseInt(t_ly_cnt.get(index - 1), 10));
						}	
						
						if (!Util.isEmptyString(t_ps_cnt.get(index - 1)) && Integer.parseInt(t_ps_cnt.get(index - 1), 10) != 0) {
							totalTps = totalTps + Integer.parseInt(t_ps_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(27);
					        cell.setCellValue(Integer.parseInt(t_ps_cnt.get(index - 1), 10));
						}	
						
						if (!Util.isEmptyString(t_fs_cnt.get(index - 1)) && Integer.parseInt(t_fs_cnt.get(index - 1), 10) != 0) {
							totalTfs = totalTfs + Integer.parseInt(t_fs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(28);
					        cell.setCellValue(Integer.parseInt(t_fs_cnt.get(index - 1), 10));
						}	
						
						if (!Util.isEmptyString(t_other.get(index - 1)) && Integer.parseInt(t_other.get(index - 1), 10) != 0) {
							totalTother = totalTother + Integer.parseInt(t_other.get(index - 1), 10);
							cell = sheet.getRow(j+8).getCell(29);
					        cell.setCellValue(Integer.parseInt(t_other.get(index - 1), 10));
						}
						
						if(!Util.isEmptyString(remark.get(index - 1))){
							cell = sheet.getRow(j+8).getCell(30);
					        cell.setCellValue(remark.get(index - 1));
						}
					}
				}

				cell = sheet.getRow(33).getCell(3);
		        cell.setCellValue(totalLhnbl);
		        cell = sheet.getRow(33).getCell(4);
		        cell.setCellValue(totalLllhx);
		        cell = sheet.getRow(33).getCell(5);
		        cell.setCellValue(totalLysbj);
		        cell = sheet.getRow(33).getCell(6);
		        cell.setCellValue(totalLps);
		        cell = sheet.getRow(33).getCell(7);
		        cell.setCellValue(totalLlw);
		        cell = sheet.getRow(33).getCell(8);
		        cell.setCellValue(totalLgs);
		        cell = sheet.getRow(33).getCell(9);
		        cell.setCellValue(totalLad);
		        cell = sheet.getRow(33).getCell(10);
		        cell.setCellValue(totalLtd);
		        cell = sheet.getRow(33).getCell(11);
		        cell.setCellValue(totalLwj);
		        cell = sheet.getRow(33).getCell(12);
		        cell.setCellValue(totalLother);
		        cell = sheet.getRow(33).getCell(13);
		        cell.setCellValue(totalCtd);
		        cell = sheet.getRow(33).getCell(14);
		        cell.setCellValue(totalCgs);
		        cell = sheet.getRow(33).getCell(15);
		        cell.setCellValue(totalCssbj);
		        cell = sheet.getRow(33).getCell(16);
		        cell.setCellValue(totalCzw);
		        cell = sheet.getRow(33).getCell(17);
		        cell.setCellValue(totalCpr);
		        cell = sheet.getRow(33).getCell(18);
		        cell.setCellValue(totalCly);
		        cell = sheet.getRow(33).getCell(19);
		        cell.setCellValue(totalCps);
		        cell = sheet.getRow(33).getCell(20);
		        cell.setCellValue(totalCfs);
		        cell = sheet.getRow(33).getCell(21);
		        cell.setCellValue(totalCother);
		        cell = sheet.getRow(33).getCell(22);
		        cell.setCellValue(totalTtd);
		        cell = sheet.getRow(33).getCell(23);
		        cell.setCellValue(totalTgs);
		        cell = sheet.getRow(33).getCell(24);
		        cell.setCellValue(totalTssbj);
		        cell = sheet.getRow(33).getCell(25);
		        cell.setCellValue(totalTzw);
		        cell = sheet.getRow(33).getCell(26);
		        cell.setCellValue(totalTly);
		        cell = sheet.getRow(33).getCell(27);
		        cell.setCellValue(totalTps);
		        cell = sheet.getRow(33).getCell(28);
		        cell.setCellValue(totalTfs);
		        cell = sheet.getRow(33).getCell(29);
		        cell.setCellValue(totalTother);
			}
			String filename = excel.creatFile();
			FileOutputStream fileOut = new FileOutputStream(filename);  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
	        excel.printExcel(printer,filename);
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}
	
	/**
	 * for 其他客户出货信息表
	 * @param printer
	 * @param str
	 */
	public void PrintJBorDMQA3(final String printer ,final String str) {
		PrintQA printData = new PrintQA();
		System.out.println(str);
		try {
			printData = JackUtil.fromJson(str, printData);
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
		double stdQty = printData.getStdQty();
		String cusId = printData.getCusId();
		String boxId = printData.getBoxId();
		String prdCnt = printData.getPrdCnt();
		String toThickness = printData.getToThickness();
		String totalModelCnt = printData.getTotalModelCnt();
		String modelCnt = printData.getModelCnt();
		String mdlId = printData.getMdlId();
		List<String> prdId = printData.getPrdAry();
		List<String> mtrlBox = printData.getMtrlBoxAry();
		List<String> grade = printData.getGradeAry();
		List<String> lDefcnt1 = printData.getlDefcnt1Ary();
		List<String> lDefcnt2 = printData.getlDefcnt2Ary();
		List<String> lDefcnt3 = printData.getlDefcnt3Ary();
		List<String> lDefcnt4 = printData.getlDefcnt4Ary();
		List<String> lDefcnt5 = printData.getlDefcnt5Ary();
		List<String> lDefcnt6 = printData.getlDefcnt6Ary();
		List<String> lDefcnt7 = printData.getlDefcnt7Ary();
		List<String> lDefcnt8 = printData.getlDefcnt8Ary();
		List<String> lCnt = printData.getlCntAry();
		List<String> zDefcnt1 = printData.getzDefcnt1Ary();
		List<String> zDefcnt2 = printData.getzDefcnt2Ary();
		List<String> zDefcnt3 = printData.getzDefcnt3Ary();
		List<String> zDefcnt4 = printData.getzDefcnt4Ary();
		List<String> zDefcnt5 = printData.getzDefcnt5Ary();
		List<String> zDefcnt6 = printData.getzDefcnt6Ary();
		List<String> zDefcnt7 = printData.getzDefcnt7Ary();
		List<String> zDefcnt8 = printData.getzDefcnt8Ary();
		List<String> zCnt = printData.getzCntAry();
		List<String> remark = printData.getRemarkAry();
		String woId = printData.getWoId();
		String soId = printData.getSoId();
		String mtrlProdId = printData.getMtrlProdId();
	
		int loopCnt = (int) Math.ceil(stdQty / 25);
		int i;
		int j;
		int index = 1;
		for (i = 0; i < loopCnt; i++) {
			LableExcel label = new LableExcel(999, 705, 200);
			label.addText(new Text(50.8, 2.8, "宋体", 0, 10, "委外薄化/镀膜出货明细单"));
			label.addRectangle(new Rectangle(0.5, 4, 126.3, 81, 0.2));
			int totallDef1 = 0;
			int totallDef2 = 0;
			int totallDef3 = 0;
			int totallDef4 = 0;
			int totallDef5 = 0;
			int totallDef6 = 0;
			int totallDef7 = 0;
			int totallDef8 = 0;
			int totallDef = 0;
			int totalzDef1 = 0;
			int totalzDef2 = 0;
			int totalzDef3 = 0;
			int totalzDef4 = 0;
			int totalzDef5 = 0;
			int totalzDef6 = 0;
			int totalzDef7 = 0;
			int totalzDef8 = 0;
			int totalzDef = 0;
			double step_y = 2.5313;
			//线坐标
			double y1 = 4 + step_y;
			double y2 = 4 + 2 * step_y;
			double y3 = 4 + 3 * step_y;
			double y4 = 4 + 4 * step_y;
			double y5 = 4 + 29 * step_y;
			double y6 = 4 + 30 * step_y;
			//字坐标
			double Y1 = 5.9;
			double Y2 = 5.9 + step_y;
			double Y3 = 5.9 + 2 * step_y;
			double Y31 = Y3 + 0.9;
			double Y4 = 5.9 + 3 * step_y;
			double Y5 = 5.9 + 4 * step_y;
			double Y6 = 5.9 + 29 * step_y;
			double Y7 = 6.8 + 30 * step_y;

			label.addText(new Text(0.9, Y1, "宋体", 0, 6, "客户名称："));
			label.addText(new Text(9.5, Y1, "Arial", 0, 5, cusId));
			label.addText(new Text(16.8, Y1, "宋体", 0, 6, "客户料号："));
			label.addText(new Text(25.3, Y1, "Arial", 0, 5, mtrlProdId));
			label.addText(new Text(38.4, Y1, "宋体", 0, 6, "P.O.Number："));
			label.addText(new Text(48.3, Y1, "Arial", 0, 5, soId));
			label.addText(new Text(69.2, Y1, "宋体", 0, 6, "装箱PPBOX-ID："));
			label.addText(new Text(80, Y1, "Arial", 0, 5, boxId));
			label.addText(new Text(98, Y1, "宋体", 0, 6, "薄化厚度："));
			label.addText(new Text(106.2, Y1, "Arial", 0, 5, toThickness));

			label.addText(new Text(0.9, Y2, "宋体", 0, 6, "箱内片数："));
			label.addText(new Text(9.5, Y2, "Arial", 0, 5, prdCnt));
			label.addText(new Text(16.8, Y2, "宋体", 0, 6, "总粒数："));
			label.addText(new Text(23.7, Y2, "Arial", 0, 5, totalModelCnt));
			label.addText(new Text(38.4, Y2, "宋体", 0, 6, "出货检测日期："));
			label.addText(new Text(49.3, Y2, "Arial", 0, 5, JackUtil.getCurDate()));
			label.addText(new Text(69.2, Y2, "宋体", 0, 6, "产品模数："));
			label.addText(new Text(77.4, Y2, "Arial", 0, 5, modelCnt));
			label.addText(new Text(98, Y2, "宋体", 0, 6, "产品型号："));
			label.addText(new Text(106.2, Y2, "Arial", 0, 5, mdlId));

			label.addLine(new Line(38.1, 4, 5.06, 0.2, -90));
			label.addLine(new Line(69, 4, 5.06, 0.2, -90));
			label.addLine(new Line(97.6, 4, 5.06, 0.2, -90));

			label.addText(new Text(0.9, Y3, "宋体", 0, 6, "序"));
			label.addText(new Text(0.9, Y4, "宋体", 0, 6, "号"));
			label.addLine(new Line(2.8, y2, 68.35, 0.2, -90));
			label.addText(new Text(6.7, Y31, "宋体", 0, 6, "基板ID号"));
			label.addLine(new Line(16.5, 4, 73.41, 0.2, -90));
			label.addText(new Text(22.8, Y31, "宋体", 0, 6, "原箱号"));
			label.addLine(new Line(34, y2, 68.35, 0.2, -90));
			label.addText(new Text(34.6, Y31, "宋体", 0, 6, "状态"));
			label.addLine(new Line(38.1, y2, 70.86, 0.2, -90));
			label.addText(new Text(55.1, Y3, "宋体", 0, 6, "来料不良"));
			label.addText(new Text(38.4, Y4, "宋体", 0, 6, "来料标记"));
			label.addLine(new Line(44.6, y3, 68.35, 0.2, -90));
			label.addText(new Text(44.9, Y4, "宋体", 0, 6, "液晶异常"));
			label.addLine(new Line(51.2, y3, 68.35, 0.2, -90));
			label.addText(new Text(51.5, Y4, "宋体", 0, 6, "凹凸点"));
			label.addLine(new Line(56.5, y3, 68.35, 0.2, -90));
			label.addText(new Text(56.9, Y4, "宋体", 0, 6, "破损"));
			label.addLine(new Line(60.2, y3, 68.35, 0.2, -90));
			label.addText(new Text(60.5, Y4, "宋体", 0, 6, "划伤"));
			label.addLine(new Line(63.8, y3, 68.35, 0.2, -90));
			label.addText(new Text(64.1, Y4, "宋体", 0, 6, "滚轮印"));
			label.addLine(new Line(69, y3, 68.35, 0.2, -90));
			label.addText(new Text(69.2, Y4, "宋体", 0, 6, "pit点"));
			label.addLine(new Line(73.2, y3, 68.35, 0.2, -90));
			label.addText(new Text(73.5, Y4, "宋体", 0, 6, "其它"));
			label.addLine(new Line(76.9, y2, 70.86, 0.2, -90));
			label.addText(new Text(78.1, Y3, "宋体", 0, 6, "不良"));
			label.addText(new Text(77.2, Y4, "宋体", 0, 6, "cell数"));
			label.addLine(new Line(82, y2, 70.86, 0.2, -90));

			label.addText(new Text(94.9, Y3, "宋体", 0, 6, "制程不良"));
			label.addText(new Text(82.3, Y4, "宋体", 0, 6, "划伤"));
			label.addLine(new Line(85.6, y3, 68.35, 0.2, -90));
			label.addText(new Text(85.9, Y4, "宋体", 0, 6, "凹凸点"));
			label.addLine(new Line(90.9, y3, 68.35, 0.2, -90));
			label.addText(new Text(91.3, Y4, "宋体", 0, 6, "酸蚀不均"));
			label.addLine(new Line(97.6, y3, 73.41, 0.2, -90));
			label.addText(new Text(98, Y4, "宋体", 0, 6, "破损"));
			label.addLine(new Line(101.3, y3, 68.35, 0.2, -90));
			label.addText(new Text(101.6, Y4, "宋体", 0, 6, "漏液"));
			label.addLine(new Line(104.9, y3, 68.35, 0.2, -90));
			label.addText(new Text(105.2, Y4, "宋体", 0, 6, "污迹"));
			label.addLine(new Line(108.5, y3, 68.35, 0.2, -90));
			label.addText(new Text(108.8, Y4, "宋体", 0, 6, "pit点"));
			label.addLine(new Line(112.8, y3, 68.35, 0.2, -90));
			label.addText(new Text(113.1, Y4, "宋体", 0, 6, "其它"));
			label.addLine(new Line(116.5, y2, 70.86, 0.2, -90));
			label.addText(new Text(117.4, Y3, "宋体", 0, 6, "不良"));
			label.addText(new Text(116.8, Y4, "宋体", 0, 6, "cell数"));
			label.addLine(new Line(121.5, y2, 70.86, 0.2, -90));
			label.addText(new Text(122.8, Y31, "宋体", 0, 6, "备注"));

			//横线
			label.addLine(new Line(0.5, y1, 126.3, 0.2, 0));
			label.addLine(new Line(0.5, y2, 126.3, 0.2, 0));
			label.addLine(new Line(38.1, y3, 38.8, 0.2, 0));
			label.addLine(new Line(82, y3, 34.5, 0.2, 0));

			for (j = 0; j < 25; j++, index++) {
				double y = y4 + j * step_y;
				double Y = Y5 + j * step_y;
				label.addLine(new Line(0.5, y, 126.3, 0.2, 0));
				if (index <= stdQty) {
					label.addText(new Text(0.9, Y, "Arial", 0, 6, index + ""));
					label.addText(new Text(3.1, Y, "Arial", 0, 5, prdId.get(index - 1)));
					label.addText(new Text(16.8, Y, "Arial", 0, 5, mtrlBox.get(index - 1)));
					label.addText(new Text(34.3, Y, "Arial", 0, 5, grade.get(index - 1)));

					label.addText(new Text(77.2, Y, "Arial", 0, 5, lCnt.get(index - 1)));
					label.addText(new Text(116.8, Y, "Arial", 0, 5, zCnt.get(index - 1)));

					if (!Util.isEmptyString(lDefcnt1.get(index - 1)) && Integer.parseInt(lDefcnt1.get(index - 1), 10) != 0) {
						totallDef1 = totallDef1 + Integer.parseInt(lDefcnt1.get(index - 1), 10);
						label.addText(new Text(38.4, Y, "Arial", 0, 5, lDefcnt1.get(index - 1)));
					}
					if (!Util.isEmptyString(lDefcnt2.get(index - 1)) && Integer.parseInt(lDefcnt2.get(index - 1), 10) != 0) {
						totallDef2 = totallDef2 + Integer.parseInt(lDefcnt2.get(index - 1), 10);
						label.addText(new Text(44.9, Y, "Arial", 0, 5, lDefcnt2.get(index - 1)));
					}
					if (!Util.isEmptyString(lDefcnt3.get(index - 1)) && Integer.parseInt(lDefcnt3.get(index - 1), 10) != 0) {
						totallDef3 = totallDef3 + Integer.parseInt(lDefcnt3.get(index - 1), 10);
						label.addText(new Text(51.5, Y, "Arial", 0, 5, lDefcnt3.get(index - 1)));
					}
					if (!Util.isEmptyString(lDefcnt4.get(index - 1)) && Integer.parseInt(lDefcnt4.get(index - 1), 10) != 0) {
						totallDef4 = totallDef4 + Integer.parseInt(lDefcnt4.get(index - 1), 10);
						label.addText(new Text(56.8, Y, "Arial", 0, 5, lDefcnt4.get(index - 1)));
					}
					if (!Util.isEmptyString(lDefcnt5.get(index - 1)) && Integer.parseInt(lDefcnt5.get(index - 1), 10) != 0) {
						totallDef5 = totallDef5 + Integer.parseInt(lDefcnt5.get(index - 1), 10);
						label.addText(new Text(60.5, Y, "Arial", 0, 5, lDefcnt5.get(index - 1)));
					}
					if (!Util.isEmptyString(lDefcnt6.get(index - 1)) && Integer.parseInt(lDefcnt6.get(index - 1), 10) != 0) {
						totallDef6 = totallDef6 + Integer.parseInt(lDefcnt6.get(index - 1), 10);
						label.addText(new Text(64.1, Y, "Arial", 0, 5, lDefcnt6.get(index - 1)));
					}
					if (!Util.isEmptyString(lDefcnt7.get(index - 1)) && Integer.parseInt(lDefcnt7.get(index - 1), 10) != 0) {
						totallDef7 = totallDef7 + Integer.parseInt(lDefcnt7.get(index - 1), 10);
						label.addText(new Text(69.3, Y, "Arial", 0, 5, lDefcnt7.get(index - 1)));
					}
					if (!Util.isEmptyString(lDefcnt8.get(index - 1)) && Integer.parseInt(lDefcnt8.get(index - 1), 10) != 0) {
						totallDef8 = totallDef8 + Integer.parseInt(lDefcnt8.get(index - 1), 10);
						label.addText(new Text(73.5, Y, "Arial", 0, 5, lDefcnt8.get(index - 1)));
					}
					if (!Util.isEmptyString(lCnt.get(index - 1))) {
						totallDef = totallDef + Integer.parseInt(lCnt.get(index - 1), 10);
					}
					if (!Util.isEmptyString(zDefcnt1.get(index - 1)) && Integer.parseInt(zDefcnt1.get(index - 1), 10) != 0) {
						totalzDef1 = totalzDef1 + Integer.parseInt(zDefcnt1.get(index - 1), 10);
						label.addText(new Text(82.3, Y, "Arial", 0, 5, zDefcnt1.get(index - 1)));
					}
					if (!Util.isEmptyString(zDefcnt2.get(index - 1)) && Integer.parseInt(zDefcnt2.get(index - 1), 10) != 0) {
						totalzDef2 = totalzDef2 + Integer.parseInt(zDefcnt2.get(index - 1), 10);
						label.addText(new Text(85.9, Y, "Arial", 0, 5, zDefcnt2.get(index - 1)));
					}
					if (!Util.isEmptyString(zDefcnt3.get(index - 1)) && Integer.parseInt(zDefcnt3.get(index - 1), 10) != 0) {
						totalzDef3 = totalzDef3 + Integer.parseInt(zDefcnt3.get(index - 1), 10);
						label.addText(new Text(91.2, Y, "Arial", 0, 5, zDefcnt3.get(index - 1)));
					}
					if (!Util.isEmptyString(zDefcnt4.get(index - 1)) && Integer.parseInt(zDefcnt4.get(index - 1), 10) != 0) {
						totalzDef4 = totalzDef4 + Integer.parseInt(zDefcnt4.get(index - 1), 10);
						label.addText(new Text(97.9, Y, "Arial", 0, 5, zDefcnt4.get(index - 1)));
					}
					if (!Util.isEmptyString(zDefcnt5.get(index - 1)) && Integer.parseInt(zDefcnt5.get(index - 1), 10) != 0) {
						totalzDef5 = totalzDef5 + Integer.parseInt(zDefcnt5.get(index - 1), 10);
						label.addText(new Text(101.6, Y, "Arial", 0, 5, zDefcnt5.get(index - 1)));
					}
					if (!Util.isEmptyString(zDefcnt6.get(index - 1)) && Integer.parseInt(zDefcnt6.get(index - 1), 10) != 0) {
						totalzDef6 = totalzDef6 + Integer.parseInt(zDefcnt6.get(index - 1), 10);
						label.addText(new Text(105.2, Y, "Arial", 0, 5, zDefcnt6.get(index - 1)));
					}
					if (!Util.isEmptyString(zDefcnt7.get(index - 1)) && Integer.parseInt(zDefcnt7.get(index - 1), 10) != 0) {
						totalzDef7 = totalzDef7 + Integer.parseInt(zDefcnt7.get(index - 1), 10);
						label.addText(new Text(108.8, Y, "Arial", 0, 5, zDefcnt7.get(index - 1)));
					}
					if (!Util.isEmptyString(zDefcnt8.get(index - 1)) && Integer.parseInt(zDefcnt8.get(index - 1), 10) != 0) {
						totalzDef8 = totalzDef8 + Integer.parseInt(zDefcnt8.get(index - 1), 10);
						label.addText(new Text(113.1, Y, "Arial", 0, 5, zDefcnt8.get(index - 1)));
					}
					if (!Util.isEmptyString(zCnt.get(index - 1))) {
						totalzDef = totalzDef + Integer.parseInt(zCnt.get(index - 1), 10);
					}
					label.addText(new Text(122, Y, "宋体", 0, 6, remark.get(index - 1)));
				}
			}
			label.addText(new Text(38.4, Y6, "Arial", 0, 5, totallDef1 + ""));
			label.addText(new Text(44.9, Y6, "Arial", 0, 5, totallDef2 + ""));
			label.addText(new Text(51.5, Y6, "Arial", 0, 5, totallDef3 + ""));
			label.addText(new Text(56.8, Y6, "Arial", 0, 5, totallDef4 + ""));
			label.addText(new Text(60.5, Y6, "Arial", 0, 5, totallDef5 + ""));
			label.addText(new Text(64.1, Y6, "Arial", 0, 5, totallDef6 + ""));
			label.addText(new Text(69.3, Y6, "Arial", 0, 5, totallDef7 + ""));
			label.addText(new Text(73.5, Y6, "Arial", 0, 5, totallDef8 + ""));
			label.addText(new Text(77.2, Y6, "Arial", 0, 5, totallDef + ""));
			label.addText(new Text(82.3, Y6, "Arial", 0, 5, totalzDef1 + ""));
			label.addText(new Text(85.9, Y6, "Arial", 0, 5, totalzDef2 + ""));
			label.addText(new Text(91.2, Y6, "Arial", 0, 5, totalzDef3 + ""));
			label.addText(new Text(97.9, Y6, "Arial", 0, 5, totalzDef4 + ""));
			label.addText(new Text(101.6, Y6, "Arial", 0, 5, totalzDef5 + ""));
			label.addText(new Text(105.2, Y6, "Arial", 0, 5, totalzDef6 + ""));
			label.addText(new Text(108.8, Y6, "Arial", 0, 5, totalzDef7 + ""));
			label.addText(new Text(113.1, Y6, "Arial", 0, 5, totalzDef8 + ""));
			label.addText(new Text(116.8, Y6, "Arial", 0, 5, totalzDef + ""));

			label.addLine(new Line(0.5, y5, 126.3, 0.2, 0));
			label.addText(new Text(19.4, Y6, "宋体", 0, 6, "总计"));
			label.addLine(new Line(0.5, y6, 126.3, 0.2, 0));
			label.addText(new Text(0.9, Y7, "宋体", 0, 6, "备注："));
			label.addText(new Text(97.9, Y7, "宋体", 0, 6, "内部订单号："));
			label.addText(new Text(107.8, Y7, "Arial", 0, 5, woId));
			label.addText(new Text(0.9, 86.7, "宋体", 0, 6, "保存部门：品质部"));
			label.addText(new Text(101.4, 86.7, "宋体", 0, 6, "表码："));
			label.addText(new Text(106.2, 86.7, "Arial", 0, 6, "FMWG-WI-CD-QA 117-02B"));
			label.addText(new Text(99, 88.9, "宋体", 0, 6, " 确认人："));

			try {
				label.print(printer);
			} catch (Exception e) {
				e.printStackTrace();
			}
			label.dispose();
		}
	}
	
	// 来料标签
	public void printyl(final String customer_id, final String mode_id,
			final String date, final String prd_spec, final String wo_id,
			final String woCnt, final String jsonCntAry, final String boxRule,
			final String totalCnt, final String jsonAry,
			final String layout_cnt, final String mtrl_id, final String habk_id,final String cuswo) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {
				ObjectMapper mapper = new ObjectMapper();
				String[] ja = null;
				String[] jaCnt = null;
				try {
					ja = mapper.readValue(jsonAry, String[].class);
				} catch (Exception e) {
					System.out.println("Error took place");
					e.printStackTrace();
				}
				try {
					jaCnt = mapper.readValue(jsonCntAry, String[].class);
				} catch (Exception e) {
					System.out.println("Error took place");
					e.printStackTrace();
				}
				System.out.println("Start1");
				int len = ja.length;
				System.out.println(len);
				ActiveXComponent axc = new ActiveXComponent("pt1.ct1");
				Dispatch dispatch = axc.getObject();
				for (int i = 0; i < len; i++) {
					Variant v = Dispatch.call(dispatch, "ct1", ja[i],
							customer_id, wo_id, woCnt, jaCnt[i],
							(Integer.parseInt(boxRule) + i) + " / " + totalCnt,
							mode_id + "(" + layout_cnt + "模)", prd_spec, date,
							habk_id, mtrl_id,cuswo);
				}
				return null;
			}
		});

	}
	//088客户标签
	public void PrintFor088(final String printer,final String box_id, final String product_id, final String ppbox_id, final String time,
            final String user_id, final String cnt, final String t_thickness,final String c_thickness) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
	
				ActiveXComponent axc = new ActiveXComponent("pt1.ct8");
	
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct8", printer, box_id, product_id, ppbox_id,time,
				             user_id, cnt,t_thickness, c_thickness);

				return null;
			}
		});
	}
	//003客户标签
	public void PrintForOK003(final String cus_id, final String box_id, final String cpt_type, final String suffix, final String cpt_no,
			                final String glass, final String item_no, final String cnt, final String date, final String okcnt,
			                final String inspector, final String remark, final String substrate, final String tcn_no) {
	
			LabelJX label = new LabelJX(100, 90, 300);
			label.addText(new Text(10, 5, "Arial", 0, 17, "CHUNGHWA PICTURE TUBES,LTD"));
			label.addRectangle(new Rectangle(2, 7, 90, 75, 0.2));
			label.addText(new Text(3, 10.5, "Arial", 0, 12, "Customer"));
			label.addLine(new Line(2, 12.5,90, 0.2, 0));
			label.addText(new Text(3, 18, "Arial", 0, 12, "Packge NO."));
			label.addLine(new Line(2, 26,90, 0.2, 0));
			Code code = new Code(25, 13, 12, 0.30, box_id);
				try {
					label.addCode128(code);
				} catch (IOException e) {
					e.printStackTrace();
				}
			label.addLine(new Line(21, 7, 75, 0.2, -90));
			label.addText(new Text(3, 29.5, "Arial", 0, 12, "CPT Type"));
			label.addLine(new Line(2, 31.5,90, 0.2, 0));
			label.addText(new Text(3, 35, "Arial", 0, 12, "CPT NO."));
			label.addLine(new Line(2, 37,90, 0.2, 0));
			label.addText(new Text(3, 40.5, "Arial", 0, 12, "Customer"));
			label.addText(new Text(3, 44.5, "Arial", 0, 12, "Item NO."));
			label.addLine(new Line(2, 46.5,90, 0.2, 0));
			label.addText(new Text(3, 50, "Arial", 0, 12, "Quantity"));
			label.addLine(new Line(2, 52,90, 0.2, 0));
			label.addText(new Text(3, 55.5, "Arial", 0, 12, "OK/Total"));
			label.addText(new Text(3, 59.5, "Arial", 0, 12, "Count(pcs)"));
			label.addLine(new Line(2, 61.5,90, 0.2, 0));
			label.addText(new Text(3, 65, "Arial", 0, 12, "Remark"));
			label.addLine(new Line(2, 67,90, 0.2, 0));
			label.addText(new Text(3, 70.5, "Arial", 0, 12, "Substrate"));
			label.addText(new Text(3, 74.5, "Arial", 0, 12, "Type"));
			label.addLine(new Line(2, 76.5,90, 0.2, 0));
			label.addText(new Text(3, 80, "Arial", 0, 12, "TCN NO."));
			label.addText(new Text(22, 10.5, "Arial", 0, 12, cus_id));
			label.addText(new Text(22, 29.5, "Arial", 0, 12, cpt_type));
			label.addText(new Text(56, 29.5, "Arial", 0, 12, "Suffix"));
			label.addLine(new Line(55, 26, 11, 0.2, -90));
			label.addText(new Text(70, 29.5, "Arial", 0, 12, suffix));
			label.addLine(new Line(69, 26, 11, 0.2, -90));
			label.addText(new Text(22, 35, "Arial", 0, 12, cpt_no));
			label.addText(new Text(56, 35, "Arial", 0, 12, "Glass"));
			label.addText(new Text(70, 35, "Arial", 0, 12, glass));
			label.addLine(new Line(55, 46.5, 15, 0.2, -90));
			label.addLine(new Line(69, 46.5, 15, 0.2, -90));
			label.addText(new Text(22, 50, "Arial", 0, 12, cnt));
			label.addText(new Text(56, 50, "Arial", 0, 12, "Date"));
			label.addText(new Text(70, 50, "Arial", 0, 12, date));
			label.addText(new Text(22, 57.5, "Arial", 0, 12, okcnt));
			label.addText(new Text(56, 57.5, "Arial", 0, 12, "Inspector"));
			label.addText(new Text(70, 57.5, "Arial", 0, 12, inspector));
			label.addText(new Text(22, 65, "Arial", 0, 12, remark));
			label.addText(new Text(22, 72.5, "Arial", 0, 12, substrate));
			label.addText(new Text(22, 80, "Arial", 0, 12, tcn_no));
			label.addText(new Text(22, 42.5, "Arial", 0, 12, item_no));
			try {
				label.print();
			} catch (Exception e) {
				e.printStackTrace();
			}
			label.dispose();
		
	}
	
	//003客户报废标签
	public void PrintForNG003(final String box_id, final String model, final String lotid, final String cnt, final String stat,final String date) {
	
			LabelJX label = new LabelJX(100, 90, 300);
			label.addText(new Text(13, 5, "宋体", 0, 17, "江西沃格光电股份有限公司"));
			label.addRectangle(new Rectangle(2, 7, 90, 73, 0.2));
			label.addText(new Text(3, 12, "宋体", 0, 12, "外包商"));
			label.addLine(new Line(2, 15.5,90, 0.2, 0));
			label.addText(new Text(3, 23.5, "宋体", 0, 12, "内箱号"));
			label.addLine(new Line(2, 29,90, 0.2, 0));
			label.addLine(new Line(23, 7, 73, 0.2, -90));
			Code code = new Code(25, 16.5, 12, 0.30, box_id);
				try {
					label.addCode128(code);
				} catch (IOException e) {
					e.printStackTrace();
				}
				label.addText(new Text(3, 34, "宋体", 0, 12, "型名"));
				label.addLine(new Line(2, 37.5,90, 0.2, 0));
				label.addText(new Text(3, 42.5, "宋体", 0, 12, "批号"));
				label.addLine(new Line(2, 46,90, 0.2, 0));
				label.addText(new Text(3, 51, "宋体", 0, 12, "品位"));
				label.addLine(new Line(2, 54.5,90, 0.2, 0));
				label.addText(new Text(3, 59.5, "宋体", 0, 12, "数量(pcs)"));
				label.addLine(new Line(2, 63,90, 0.2, 0));
				label.addText(new Text(3, 68, "宋体", 0, 12, "基板种类"));
				label.addLine(new Line(2, 71.5,90, 0.2, 0));
				label.addText(new Text(3, 76.5, "宋体", 0, 12, "日期"));
				label.addText(new Text(27, 12, "宋体", 0, 12, "江西沃格光电股份有限公司"));
				label.addText(new Text(27, 34, "Arial", 0, 12, model));
				label.addText(new Text(27, 42.5, "Arial", 0, 12, lotid));
				label.addText(new Text(27, 51, "Arial", 0, 12, "X"));
				label.addText(new Text(27, 59.5, "Arial", 0, 12, cnt));
				label.addText(new Text(35, 68, "宋体", 0, 12, "未薄化"));
				label.addtCircle(new TCircle(72.5, 67, 6,3.8,0.3));
				label.addText(new Text(68, 68, "宋体", 0, 12, "已薄化"));
				label.addText(new Text(27, 76.5, "Arial", 0, 12, date));
				label.addLine(new Line(56, 63, 8.5, 0.2, -90));
			try {
				label.print();
			} catch (Exception e) {
				e.printStackTrace();
			}
			label.dispose();
		
	}
	
	//088客户oncell标签
	public void PrintForoncell088(final String printer, final String box_id, final String product_id, final String time,
            final String user_id, final String cnt, final String t_thickness,final String c_thickness) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
	
				ActiveXComponent axc = new ActiveXComponent("pt1.ct9");
	
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct9",printer, box_id,product_id,time,user_id,cnt,t_thickness,c_thickness);

				return null;
			}
		});
	}
	//028客户标签
	public void PrintFor028(final String printer, final String cusid, final String woid, final String mtrid,
            final String lotid, final String checktime, final String endtime,
            final String soid,final String proid,final String wxwoid,
            final String cnt,final String user,final String content) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
	
				ActiveXComponent axc = new ActiveXComponent("pt1.ct6");
	
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct6",printer, cusid, woid, mtrid,lotid, checktime, endtime,
			                soid,proid,wxwoid,cnt,user,content);

				return null;
			}
		});
	}
	//008客户标签
	public void PrintFor008(final String printer, final String mdlid, final String date, final String boxid,
            final String cnt, final String mtrl, final String grade) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
	
				ActiveXComponent axc = new ActiveXComponent("pt1.ct4");
	
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct4",printer, mdlid, date, boxid, cnt,
							mtrl, grade);

				return null;
			}
		});
	}
	
	//栈板标签
	public void PrintForPallet(final String palletId, final String mdlId, final String mtrId,
            final String shtCnt, final String okCnt, final String substrate,
            final String tcn,final String actSo,final String outDate,final String boxCnt) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start");
	
				ActiveXComponent axc = new ActiveXComponent("pt1.ct10");
	
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct10", palletId, mdlId, mtrId,shtCnt, okCnt, substrate,
							tcn,actSo,outDate,boxCnt);

				return null;
			}
		});
	}
	
	//006
	public void PrintLabelForDM006(final String printer, final String cusInfoFst, final String mdl_id,
			final String compDate, final String overDueDate,final String prdQty, final String pm) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
				
				ActiveXComponent axc = new ActiveXComponent("pt1.ct14");
		
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct14", printer, cusInfoFst, mdl_id,
							compDate, overDueDate,  prdQty, pm);

				return null;
			}
		});
	}
	
	//098
	public void PrintLabelForDM098(final String printer, final String boxId, final String productId1, final String productId2,
			final String prdQty, final String thickness, final String compDate, final String dmUser, final String soId,
			final String prdStat, final String prdType, final String overDueDate,final String jsonAry) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {
				ObjectMapper mapper = new ObjectMapper();
				String[] ja = null;
				try {
					ja = mapper.readValue(jsonAry, String[].class);
				} catch (Exception e) {
					System.out.println("Error took place");
					e.printStackTrace();
				}
				String sht1 = "";
				String sht2 = "";
				String sht3 = "";
				String sht4 = "";
				String sht5 = "";
				String sht6 = "";
				String sht7 = "";
				String sht8 = "";
				String sht9 = "";
				String sht10 = "";
				String sht11 = "";
				String sht12 = "";
			
					sht1 = ja[0];
					sht2 = ja[1];
					sht3 = ja[2];
					sht4 = ja[3];
					sht5 = ja[4];
					sht6 = ja[5];
					sht7 = ja[6];
					sht8 = ja[7];
					sht9 = ja[8];
					sht10 = ja[9];
					sht11 = ja[10];
					sht12 = ja[11];

				System.out.println("Start2");
				
				ActiveXComponent axc = new ActiveXComponent("pt1.ct15");
		
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct15", printer,  boxId,  productId1,  productId2,
							 prdQty, thickness, compDate, dmUser, soId, prdStat, prdType, overDueDate,sht1,
							 sht2,sht3,sht4,sht5,sht6,sht7,sht8,sht9,sht10,sht11,sht12);

				return null;
			}
		});
	}
	
	//whout pallet common
	public void PrintWhout(final String printer ,final String str) {
		try{
			PrintPallet printData = new PrintPallet();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
			
			double stdQty = printData.getStdQty();
			int loopCnt = (int) Math.ceil(stdQty);
			List<String> mdlCateAry = printData.getMdlCateAry();
			List<String> mdlIdAry = printData.getMdlIdAry();
			List<String> countAry = printData.getCountAry();
			List<String> dnNoAry = printData.getDnNoAry();
			List<String> cusInfoFstAry = printData.getCusInfoFstAry();
			List<String> cusInfoSndAry = printData.getCusInfoSndAry();
			List<String> palletIdAry = printData.getPalletIdAry();
			List<String> boxIdsAry = printData.getBoxIdsAry();
			
			Print excel = new Print("B",loopCnt);
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
			for (int i = 0; i < loopCnt; i++) {
				//读取了workbook内sheet内容  
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1)));
		        HSSFCell cell = sheet.getRow(3).getCell(0);
		        StringBuffer mdlName = new StringBuffer();
		        String mdlCate = mdlCateAry.get(i);
		        
		        if(mdlCate.length()>=1){
			        if("A".equals(mdlCate.substring(0,1))){
			        	mdlName.append("减薄");
			        }else if("B".equals(mdlCate.substring(0,1))){
			        	mdlName.append("镀膜");
			        }else if("C".equals(mdlCate.substring(0,1))){
			        	mdlName.append("切割");
			        }else{
			        	mdlName.append("未知");
			        }
		        }

		        if(mdlCate.length()>=2){
			        if("A".equals(mdlCate.substring(1,2))){
			        	mdlName.append("+").append("减薄");
			        }else if("B".equals(mdlCate.substring(1,2))){
			        	mdlName.append("+").append("镀膜");
			        }else if("C".equals(mdlCate.substring(1,2))){
			        	mdlName.append("+").append("切割");
			        }else{
			        	mdlName.append("未知");
			        }
		        }

		        if(mdlCate.length()>=3){
			        if("A".equals(mdlCate.substring(2,3))){
			        	mdlName.append("+").append("减薄");
			        }else if("B".equals(mdlCate.substring(2,3))){
			        	mdlName.append("+").append("镀膜");
			        }else if("C".equals(mdlCate.substring(2,3))){
			        	mdlName.append("+").append("切割");
			        }else{
			        	mdlName.append("未知");
			        }
		        }

		        if(mdlCate.length()<1){
		        	mdlName.append("未知");
		        }
		        cell.setCellValue(" " + mdlName + "产品（           ）");
		        cell = sheet.getRow(5).getCell(0);
		        cell.setCellValue(" 型号：" + mdlIdAry.get(i));
		        cell = sheet.getRow(6).getCell(0);
		        cell.setCellValue(" 数量：" + countAry.get(i) + "PCS");
		        cell = sheet.getRow(7).getCell(0);
		        cell.setCellValue(" 交货订单号：" + dnNoAry.get(i));
		        cell = sheet.getRow(8).getCell(0);
		        cell.setCellValue(" 委外工单号：" + cusInfoFstAry.get(i));
		        cell = sheet.getRow(9).getCell(0);
		        cell.setCellValue(" 工单号：" + cusInfoSndAry.get(i));
		        cell = sheet.getRow(10).getCell(0);
		        cell.setCellValue(" 栈板号：" + palletIdAry.get(i));
		        cell = sheet.getRow(11).getCell(0);
		        cell.setCellValue(" 箱清单：" + boxIdsAry.get(i));
			}
	        String filename = excel.creatPalletFile();
			FileOutputStream fileOut = new FileOutputStream(filename);  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
	        excel.printExcel(printer,filename);
		}catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}
	
	//003
	public void PrintLabelForDM003(final String printer, final String boxId,final String mdl_id, final String mtrlId,
			final String toThickness, final String prdQty, final String compDate, final String okCnt, final String Substrate, 
			final String mtrlPart, final String tcn) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
				
				ActiveXComponent axc = new ActiveXComponent("pt1.ct17");
		
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct17", printer, boxId, mdl_id,mtrlId,toThickness,
							prdQty,compDate, okCnt,  Substrate, mtrlPart,tcn);

				return null;
			}
		});
	}
	
	//007
	public void PrintLabelForDM007(final String printer, final String mtrlId,final String mtrlBoxId, final String prdQty,final String boxId) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
				
				ActiveXComponent axc = new ActiveXComponent("pt1.ct12");
		
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct12", printer, mtrlId, mtrlBoxId,prdQty,boxId);

				return null;
			}
		});
	}
	
	//007 pallet
	public void PrintLabelForWhot007(final String printer, final String mtrlId,final String BoxQty, final String totalQty,final String palletId) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
				
				ActiveXComponent axc = new ActiveXComponent("pt1.ct11");
		
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct11", printer, mtrlId, BoxQty,totalQty,palletId);

				return null;
			}
		});
	}
	
	//003 pallet
	public void PrintLabelForWhot003(final String printer, final String palletId,final String mdlId, final String mtrlId,final String totalCnt,final String oktotalCnt,
			      final String substrate,final String tcnNo,final String soId,final String date,final String boxCnt,final String type) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
				
				ActiveXComponent axc = new ActiveXComponent("pt1.ct10");
		
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct10", printer, palletId, mdlId,mtrlId,totalCnt,oktotalCnt,substrate,
							tcnNo,soId,date,boxCnt,type);

				return null;
			}
		});
	}
	
	// box
	public void PrintLabelForBox(final String boxId) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
				
				ActiveXComponent axc = new ActiveXComponent("pt1.ct20");
		
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct20", boxId);

				return null;
			}
		});
	}


	public void PrintJBorHX(final String printer, final String str) {
		try {
			String dateString = JackUtil.getCurTime();
			PrintYNK007 printData = new PrintYNK007();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);

			double stdQty = printData.getStdQty();
			String procId = printData.getProcId();
			String cusId = printData.getCusId();
			String boxId = printData.getBoxId();
			String prdCnt = printData.getPrdCnt();
			String toThickness = printData.getToThickness();
			String totalModelCnt = printData.getTotalModelCnt();
			String modelCnt = printData.getModelCnt();
			String mdlId = printData.getMdlId();
			List<String> prdId = printData.getPrdAry();
			List<String> C_hs_cnt = printData.getcHsAry();
			List<String> C_ad_cnt = printData.getcAdAry();
			List<String> C_gs_cnt = printData.getCgsAry();
			List<String> C_shbj_cnt = printData.getcShbjAry();
			List<String> C_ps_cnt = printData.getcPsAry();
			List<String> C_zw_cnt = printData.getcZwAry();
			List<String> C_ly_cnt = printData.getcLyAry();
			List<String> C_other = printData.getcOtherAry();
			List<String> C_oemz_wgs_cnt = printData.getCoemzwgsAry();
			List<String> C_zc_gs_cnt = printData.getCzcgsAry();
			List<String> C_bmzw_cnt = printData.getCbmzwAry();
			List<String> C_td_cnt = printData.getCtdaAry();
//			List<String> T_ps_cnt = printData.gettPsAry();
//			List<String> T_zw_cnt = printData.gettZwAry();
//			List<String> T_ly_cnt = printData.gettLyAry();
//			List<String> T_other = printData.gettOtherAry();
			List<String> remark = printData.getRemarkAry();
			String woId = printData.getWoId();
			String whole_def_cnt = printData.getWhole_def_cnt();
			String whole_yield = printData.getWhole_yield();
			String checkUser = printData.getCheckUser();
			String printTyp = printData.getPrintTyp();
			String modelTyp = "2";
			String shipBoxId = printData.getShipBoxId();
			int m = 25;
			int n = 33;
			int loopCnt = 1;
			if (cusId.equals("007")) {
				m = 30;
				n = 38;
				loopCnt = (int) Math.ceil(stdQty / 30);
				modelTyp = "E";
			} else {
				m = 25;
				n = 33;
				loopCnt = (int) Math.ceil(stdQty / 25);
				modelTyp = "3";
			}

			String procTyp = "";
			if ("JBQA".equals(procId)){
				procTyp = "JB";
			} else {
				procTyp = "DM";
			}

			Print excel = new Print(boxId, dateString, printTyp, modelTyp, loopCnt, procTyp, cusId, woId);
			// 根据excel模板，新建workbook
			HSSFWorkbook workbook = excel.creatWorkbook();

			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
				// 读取了workbook内sheet内容
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1)));

				int totalyjyc = 0;
				int totalsy = 0;
				int totalChs = 0;
				int totalCad = 0;
				int totalCtd = 0;
				int totalCshbj = 0;
				int totalCps = 0;
				int totalCzw = 0;
				int totalCly = 0;
				int totalCother = 0;
				int totalThs = 0;
				int totalTad = 0;
				int totalTtd = 0;
				int totalTshbj = 0;
				int totalTps = 0;
				int totalTzw = 0;
				int totalTly = 0;
				int totalTother = 0;

				// 第一行
				HSSFCell cell = sheet.getRow(3).getCell(1);
				cell.setCellValue(cusId);
				cell = sheet.getRow(3).getCell(3);
				cell.setCellValue(toThickness + "mm");
				cell = sheet.getRow(3).getCell(8);
				cell.setCellValue(boxId);
				cell = sheet.getRow(3).getCell(14);
				cell.setCellValue(Integer.parseInt(prdCnt, 10));
				if (cusId.equals("007")) {
					cell = sheet.getRow(3).getCell(17);
				} else {
					cell = sheet.getRow(3).getCell(18);
				}
				cell.setCellValue(Integer.parseInt(whole_def_cnt, 10));
				if (cusId.equals("007")) {
					cell = sheet.getRow(3).getCell(19);
				} else {
					cell = sheet.getRow(3).getCell(20);
				}
				cell.setCellValue(checkUser);
				// 第二行
				cell = sheet.getRow(4).getCell(1);
				cell.setCellValue(mdlId);
				cell = sheet.getRow(4).getCell(3);
				cell.setCellValue(woId);
				cell = sheet.getRow(4).getCell(8);
				cell.setCellValue(JackUtil.getCurDate());
				cell = sheet.getRow(4).getCell(14);
				cell.setCellValue(Integer.parseInt(modelCnt, 10));
				if (cusId.equals("007")) {
					cell = sheet.getRow(4).getCell(17);
				} else {
					cell = sheet.getRow(4).getCell(18);

				}
				cell.setCellValue(whole_yield + "%");

				for (j = 0; j < m; j++, index++) {
					if (index <= stdQty) {
						cell = sheet.getRow(j + 10).getCell(0);
						cell.setCellValue(index);

						if (!Util.isEmptyString(prdId.get(index - 1))) {
							cell = sheet.getRow(j + 10).getCell(1);
							cell.setCellValue(prdId.get(index - 1));
						}

						String x = C_hs_cnt.get(index - 1);
						Integer y = Integer.parseInt(C_hs_cnt.get(index - 1), 10);
						if (!Util.isEmptyString(C_hs_cnt.get(index - 1))
								&& Integer.parseInt(C_hs_cnt.get(index - 1), 10) != 0) {
							totalChs = totalChs + Integer.parseInt(C_hs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j + 10).getCell(2);
							cell.setCellValue(Integer.parseInt(C_hs_cnt.get(index - 1), 10));
						}

						if (!Util.isEmptyString(C_ad_cnt.get(index - 1))
								&& Integer.parseInt(C_ad_cnt.get(index - 1), 10) != 0) {
							totalCad = totalCad + Integer.parseInt(C_ad_cnt.get(index - 1), 10);
							cell = sheet.getRow(j + 10).getCell(3);
							cell.setCellValue(Integer.parseInt(C_ad_cnt.get(index - 1), 10));
						}

						if (!Util.isEmptyString(C_gs_cnt.get(index - 1))
								&& Integer.parseInt(C_gs_cnt.get(index - 1), 10) != 0) {
							totalCtd = totalCtd + Integer.parseInt(C_gs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j + 10).getCell(4);
							cell.setCellValue(Integer.parseInt(C_gs_cnt.get(index - 1), 10));
						}

						if (!Util.isEmptyString(C_shbj_cnt.get(index - 1))
								&& Integer.parseInt(C_shbj_cnt.get(index - 1), 10) != 0) {
							totalCshbj = totalCshbj + Integer.parseInt(C_shbj_cnt.get(index - 1), 10);
							cell = sheet.getRow(j + 10).getCell(5);
							cell.setCellValue(Integer.parseInt(C_shbj_cnt.get(index - 1), 10));
						}

						if (!Util.isEmptyString(C_ps_cnt.get(index - 1))
								&& Integer.parseInt(C_ps_cnt.get(index - 1), 10) != 0) {
							totalCps = totalCps + Integer.parseInt(C_ps_cnt.get(index - 1), 10);
							cell = sheet.getRow(j + 10).getCell(6);
							cell.setCellValue(Integer.parseInt(C_ps_cnt.get(index - 1), 10));
						}

						if (!Util.isEmptyString(C_zw_cnt.get(index - 1))
								&& Integer.parseInt(C_zw_cnt.get(index - 1), 10) != 0) {
							totalCzw = totalCzw + Integer.parseInt(C_zw_cnt.get(index - 1), 10);
							cell = sheet.getRow(j + 10).getCell(7);
							cell.setCellValue(Integer.parseInt(C_zw_cnt.get(index - 1), 10));
						}

						if (!Util.isEmptyString(C_ly_cnt.get(index - 1))
								&& Integer.parseInt(C_ly_cnt.get(index - 1), 10) != 0) {
							totalCly = totalCly + Integer.parseInt(C_ly_cnt.get(index - 1), 10);
							cell = sheet.getRow(j + 10).getCell(8);
							cell.setCellValue(Integer.parseInt(C_ly_cnt.get(index - 1), 10));
						}

						if (!Util.isEmptyString(C_other.get(index - 1))
								&& Integer.parseInt(C_other.get(index - 1), 10) != 0) {
							totalCother = totalCother + Integer.parseInt(C_other.get(index - 1), 10);
							cell = sheet.getRow(j + 10).getCell(9);
							cell.setCellValue(Integer.parseInt(C_other.get(index - 1), 10));
						}

						if (!Util.isEmptyString(C_oemz_wgs_cnt.get(index - 1))
								&& Integer.parseInt(C_oemz_wgs_cnt.get(index - 1), 10) != 0) {
							totalThs = totalThs + Integer.parseInt(C_oemz_wgs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j + 10).getCell(10);
							cell.setCellValue(Integer.parseInt(C_oemz_wgs_cnt.get(index - 1), 10));
						}

						if (!Util.isEmptyString(C_zc_gs_cnt.get(index - 1))
								&& Integer.parseInt(C_zc_gs_cnt.get(index - 1), 10) != 0) {
							totalTad = totalTad + Integer.parseInt(C_zc_gs_cnt.get(index - 1), 10);
							cell = sheet.getRow(j + 10).getCell(11);
							cell.setCellValue(Integer.parseInt(C_zc_gs_cnt.get(index - 1), 10));
						}

						if (!Util.isEmptyString(C_bmzw_cnt.get(index - 1))
								&& Integer.parseInt(C_bmzw_cnt.get(index - 1), 10) != 0) {
							totalTtd = totalTtd + Integer.parseInt(C_bmzw_cnt.get(index - 1), 10);
							cell = sheet.getRow(j + 10).getCell(12);
							cell.setCellValue(Integer.parseInt(C_bmzw_cnt.get(index - 1), 10));
						}

						if (!Util.isEmptyString(C_td_cnt.get(index - 1))
								&& Integer.parseInt(C_td_cnt.get(index - 1), 10) != 0) {
							totalTshbj = totalTshbj + Integer.parseInt(C_td_cnt.get(index - 1), 10);
							cell = sheet.getRow(j + 10).getCell(13);
							cell.setCellValue(Integer.parseInt(C_td_cnt.get(index - 1), 10));
						}

//						if (!Util.isEmptyString(T_ps_cnt.get(index - 1))
//								&& Integer.parseInt(T_ps_cnt.get(index - 1), 10) != 0) {
//							totalTps = totalTps + Integer.parseInt(T_ps_cnt.get(index - 1), 10);
//							cell = sheet.getRow(j + 8).getCell(16);
//							cell.setCellValue(Integer.parseInt(T_ps_cnt.get(index - 1), 10));
//						}

//						if (!Util.isEmptyString(T_zw_cnt.get(index - 1))
//								&& Integer.parseInt(T_zw_cnt.get(index - 1), 10) != 0) {
//							totalTzw = totalTzw + Integer.parseInt(T_zw_cnt.get(index - 1), 10);
//							cell = sheet.getRow(j + 8).getCell(17);
//							cell.setCellValue(Integer.parseInt(T_zw_cnt.get(index - 1), 10));
//						}
//
//						if (!Util.isEmptyString(T_ly_cnt.get(index - 1))
//								&& Integer.parseInt(T_ly_cnt.get(index - 1), 10) != 0) {
//							totalTly = totalTly + Integer.parseInt(T_ly_cnt.get(index - 1), 10);
//							cell = sheet.getRow(j + 8).getCell(18);
//							cell.setCellValue(Integer.parseInt(T_ly_cnt.get(index - 1), 10));
//						}
//
//						if (!Util.isEmptyString(T_other.get(index - 1))
//								&& Integer.parseInt(T_other.get(index - 1), 10) != 0) {
//							totalTother = totalTother + Integer.parseInt(T_other.get(index - 1), 10);
//							cell = sheet.getRow(j + 8).getCell(19);
//							cell.setCellValue(Integer.parseInt(T_other.get(index - 1), 10));
//						}

						if (!Util.isEmptyString(remark.get(index - 1))) {
							cell = sheet.getRow(j + 10).getCell(18);
							cell.setCellValue(remark.get(index - 1));
						}

					}
				}

//				cell = sheet.getRow(n).getCell(2);
//				cell.setCellValue(totalyjyc);
//				cell = sheet.getRow(n).getCell(3);
//				cell.setCellValue(totalsy);
				cell = sheet.getRow(i).getCell(3);
				cell.setCellValue(totalChs);
				cell = sheet.getRow(i).getCell(4);
				cell.setCellValue(totalCad);
				cell = sheet.getRow(i).getCell(5);
				cell.setCellValue(totalCtd);
				cell = sheet.getRow(i).getCell(5);
				cell.setCellValue(totalCshbj);
				cell = sheet.getRow(i).getCell(6);
				cell.setCellValue(totalCps);
				cell = sheet.getRow(i).getCell(7);
				cell.setCellValue(totalCzw);
				cell = sheet.getRow(i).getCell(8);
				cell.setCellValue(totalCly);
				cell = sheet.getRow(i).getCell(9);
				cell.setCellValue(totalCother);
				cell = sheet.getRow(i).getCell(10);
				cell.setCellValue(totalThs);
				cell = sheet.getRow(i).getCell(11);
				cell.setCellValue(totalTad);
				cell = sheet.getRow(i).getCell(12);
				cell.setCellValue(totalTtd);
				cell = sheet.getRow(i).getCell(13);
				cell.setCellValue(totalTshbj);
//				cell = sheet.getRow(n).getCell(16);
//				cell.setCellValue(totalTps);
//				cell = sheet.getRow(n).getCell(17);
//				cell.setCellValue(totalTzw);
//				cell = sheet.getRow(n).getCell(18);
//				cell.setCellValue(totalTly);
//				cell = sheet.getRow(n).getCell(19);
//				cell.setCellValue(totalTother);
				cell = sheet.getRow(i).getCell(14);
				cell.setCellValue(shipBoxId);
			}
			String filename = excel.creatFile();
			FileOutputStream fileOut = new FileOutputStream(filename);
			workbook.write(fileOut);
			fileOut.flush();
			fileOut.close();
			excel.printExcel(printer, filename);
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}



	//003 boxlist
	public void PrintLabelForWhotBoxList003(final String printer, final String jsonAry) {
	AccessController.doPrivileged(new PrivilegedAction<Object>() {
		@Override
		public Object run() {
			ObjectMapper mapper = new ObjectMapper();
			String[] ja = null;
			try {
				ja = mapper.readValue(jsonAry, String[].class);
			} catch (Exception e) {
				System.out.println("Error took place");
				e.printStackTrace();
			}
			String box1 = "";
			String box2 = "";
			String box3 = "";
			String box4 = "";
			String box5 = "";
			String box6 = "";
			String box7 = "";
			String box8 = "";
			String box9 = "";
			String box10 = "";
			String box11 = "";
			String box12 = "";
		
			box1 = ja[0];
			box2 = ja[1];
			box3 = ja[2];
			box4 = ja[3];
			box5 = ja[4];
			box6 = ja[5];
			box7 = ja[6];
			box8 = ja[7];
			box9 = ja[8];
			box10 = ja[9];
			box11 = ja[10];
			box12 = ja[11];
			System.out.println("Start2");
			
			ActiveXComponent axc = new ActiveXComponent("pt1.ct19");
	
				Dispatch dispatch = axc.getObject();
				Variant v = Dispatch.call(dispatch, "ct19", printer, box1,box2,box3,box4,box5,box6,box7,box8,box9,box10,box11,box12);

			return null;
		}
	});
}


          //HCT088客户oncell标签
	public void PrintHCToncell088(final String printer, final String boxId, final String thickness, final String time,
            final String qty, final String userID, final String product) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
	
				ActiveXComponent axc = new ActiveXComponent("pt1.ct21");
	
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct21",printer, boxId,thickness,time,qty,userID,product);

				return null;
			}
		});
	}
	//HCT088客户标签
	public void PrintHCT088(final String printer, final String soId, final String overDate, final String outwoId,
            final String qty, final String mdltyp, final String cusId,final String pm,final String boxId,
            final String blqty,final String user,final String date,final String mdlId,final String woId,
            final String okyield,final String qauser,final String bt) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
	
				ActiveXComponent axc = new ActiveXComponent("pt1.ct22");
	
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct22",printer, soId,overDate,outwoId,qty,mdltyp,cusId,
							pm,boxId,blqty,user,date,mdlId,woId,okyield,qauser,bt);

				return null;
			}
		});
	}
	//HCT058客户标签
	public void PrintHCT058(final String printer, final String ps, final String mkr, final String woId,
            final String wocate, final String mtrlId, final String qty,final String jgyq,final String date,
            final String outdate,final String boxId,final String thickness,final String dir,final String user,
            final String note) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
	
				ActiveXComponent axc = new ActiveXComponent("pt1.ct23");
	
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct23",printer, ps,mkr,woId,wocate,mtrlId,qty,
							jgyq,date,outdate,boxId,thickness,dir,user,note);

				return null;
			}
		});
	}
	
	//hct058list
	public void PrintForHCT058ShtList(final String printer,final String title, final String jsonAry, final String boxId) {
	AccessController.doPrivileged(new PrivilegedAction<Object>() {
		@Override
		public Object run() {
			ObjectMapper mapper = new ObjectMapper();
			String[] ja = null;
			try {
				ja = mapper.readValue(jsonAry, String[].class);
			} catch (Exception e) {
				System.out.println("Error took place");
				e.printStackTrace();
			}
			String sht1 = "";
			String sht2 = "";
			String sht3 = "";
			String sht4 = "";
			String sht5 = "";
			String sht6 = "";
			String sht7 = "";
			String sht8 = "";
			String sht9 = "";
			String sht10 = "";
			String sht11 = "";
			String sht12 = "";
			String sht13 = "";
			String sht14 = "";
			String sht15 = "";
			String sht16 = "";
			String sht17 = "";
			String sht18 = "";
			String sht19 = "";
			String sht20 = "";
			
		
			sht1 = ja[0];
			sht2 = ja[1];
			sht3 = ja[2];
			sht4 = ja[3];
			sht5 = ja[4];
			sht6 = ja[5];
			sht7 = ja[6];
			sht8 = ja[7];
			sht9 = ja[8];
			sht10 = ja[9];
			sht11 = ja[10];
			sht12 = ja[11];
			sht13 = ja[12];
			sht14 = ja[13];
			sht15 = ja[14];
			sht16 = ja[15];
			sht17 = ja[16];
			sht18 = ja[17];
			sht19 = ja[18];
			sht20 = ja[19];
			
			System.out.println("Start2");
			ActiveXComponent axc = new ActiveXComponent("pt1.ct24");
	
				Dispatch dispatch = axc.getObject();
				Variant v = Dispatch.call(dispatch, "ct24", printer, title,sht1,sht2,sht3,sht4,sht5,sht6,sht7,sht8,sht9,sht10,
						sht11,sht12,sht13,sht14,sht15,sht16,sht17,sht18,sht19,sht20,boxId);

			return null;
		}
	});
}
	//华南减薄common
	public void PrintForCommonJB(final String printer, final String cusId, final String boxId, final String thickness,
            final String modeCnt, final String date, final String actSo,final String mdlId, final String qty,
            final String blCnt,final String evtUser, final String note ) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
	
				ActiveXComponent axc = new ActiveXComponent("pt1.ct25");
	
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct25",printer, cusId,boxId,thickness,modeCnt,date,actSo,mdlId,qty,blCnt,evtUser,note);

				return null;
			}
		});
	}
	//009
	public void PrintForDM009(final String printer,final String mdlId, final String date ,final String boxId, final String jsonAry, final String prd_qty) {
	AccessController.doPrivileged(new PrivilegedAction<Object>() {
		@Override
		public Object run() {
			ObjectMapper mapper = new ObjectMapper();
			String[] ja = null;
			try {
				ja = mapper.readValue(jsonAry, String[].class);
			} catch (Exception e) {
				System.out.println("Error took place");
				e.printStackTrace();
			}
			String sht = "";
			for(int i=0;i<70;i++){
				sht = sht + ja[i] + ",";
			}
			System.out.println("Start2");
			ActiveXComponent axc = new ActiveXComponent("pt1.ct26");
	
				Dispatch dispatch = axc.getObject();
				Variant v = Dispatch.call(dispatch, "ct26", printer, mdlId,date,boxId,sht,prd_qty);

			return null;
		}
	});
}
	
	public void PrintForPallet009(final String printer,final String mdlId, final String qty ,final String date, final String pallet) {
	AccessController.doPrivileged(new PrivilegedAction<Object>() {
		@Override
		public Object run() {
			System.out.println("Start2");
			ActiveXComponent axc = new ActiveXComponent("pt1.ct27");
	
				Dispatch dispatch = axc.getObject();
				Variant v = Dispatch.call(dispatch, "ct27", printer, mdlId,qty,date,pallet);

			return null;
		}
	});
}
	//hc098
	public void PrintForHc098(final String printer, final String gys, final String boxId, final String cusName,
            final String mode, final String date, final String size,final String indate, final String mtrllot,
            final String orderno,final String mode2, final String cnt, final String allcnt, final String lotno,
            final String procate, final String jsonAry) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start3");
				ObjectMapper mapper = new ObjectMapper();
				String[] ja = null;
				try {
					ja = mapper.readValue(jsonAry, String[].class);
				} catch (Exception e) {
					System.out.println("Error took place");
					e.printStackTrace();
				}
				String sht = "";
				for(int i=0;i<20;i++){
					sht = sht + ja[i] + ",";
				}
				System.out.println(sht);
				ActiveXComponent axc = new ActiveXComponent("pt1.ct28");
	
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct28",printer, gys,boxId,cusName,mode,date,size,indate,mtrllot,orderno,mode2,cnt,allcnt,lotno,procate,sht);

				return null;
			}
		});
	}
	//hc098-1
	public void PrintHCT0981(final String printer, final String gys, final String boxId, final String cusName,
            final String mode, final String date, final String size,final String indate, final String mtrllot,
            final String orderno,final String mode2, final String cnt, final String allcnt, final String lotno,
            final String procate) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
				ActiveXComponent axc = new ActiveXComponent("pt1.ct29");
	
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct29",printer, gys,boxId,cusName,mode,date,size,indate,mtrllot,orderno,mode2,cnt,allcnt,lotno,procate);

				return null;
			}
		});
	}
	//hc098-2
	public void PrintHCT0982(final String printer, final String boxId, final String jsonAry) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
				ObjectMapper mapper = new ObjectMapper();
				String[] ja = null;
				try {
					ja = mapper.readValue(jsonAry, String[].class);
				} catch (Exception e) {
					System.out.println("Error took place");
					e.printStackTrace();
				}
				String sht = "";
				for(int i=0;i<20;i++){
					sht = sht + ja[i] + ",";
				}
				ActiveXComponent axc = new ActiveXComponent("pt1.ct30");
	
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct30",printer,boxId,sht);

				return null;
			}
		});
	}
	//hct068
	public void PrintHCT068(final String printer, final String soId, final String cusId,
			final String compDate, final String title,
			final String mdl_id, final String toThickness,
			final String cusInfoFst, final String cusInfoSnd,
			final String prdQty, final String NgQty, final String boxId,
			final String prdGrade, final String userId,final String woId) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
				
				ActiveXComponent axc = new ActiveXComponent("pt1.ct16");
		
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct16", printer, soId, cusId,
							compDate, title, mdl_id, toThickness, cusInfoFst,
							cusInfoSnd, prdQty, NgQty, boxId, prdGrade, userId,woId);

				return null;
			}
		});
	}
	public void PrintHCT068N(final String printer, final String cusName, final String prodName,
			final String mtrlId, final String woId,
			final String compDate, final String dueDate, final String boxId, 
			final String cusInfoFst, final String cusInfoSnd,
			final String prdQty, final String reportFLg, final String hightFlg,
            final String userId) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start");
				
				ActiveXComponent axc = new ActiveXComponent("pt1.ct48");
		
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct48", printer, cusName, prodName,
							mtrlId, woId, compDate, dueDate, boxId, cusInfoFst,
							cusInfoSnd, prdQty, reportFLg, hightFlg, userId);

				return null;
			}
		});
	}
	//whout pallet common
	public void PrintWhotHct(final String printer ,final String note, final String mdlId, final String realSo,final String prdCnt) {
		try{
			
			PrintHCT excel = new PrintHCT("E",1,false);
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
		    //读取了workbook内sheet内容  
		    HSSFSheet sheet = workbook.getSheet("sheet1");
		    HSSFCell cell = sheet.getRow(1).getCell(1);
		    cell.setCellValue(note);
		    cell = sheet.getRow(3).getCell(1);
		    cell.setCellValue("型号：" + mdlId);
		    cell = sheet.getRow(5).getCell(1);
		    cell.setCellValue("数量：" + prdCnt + "Sheet");
		    cell = sheet.getRow(7).getCell(1);
		    cell.setCellValue("客户出货PO：" + realSo);
	        String filename = excel.creatPalletFile();
			FileOutputStream fileOut = new FileOutputStream(filename);  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
	        excel.printExcel(printer,filename);
		}catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}

	//ynk流程单1
	public void PrintYNKLCD(final String printer,final String str) {
		PrintLCD1 printlcd = new PrintLCD1();
		System.out.println(str);
		try {
		printlcd = JackUtil.fromJson(str, printlcd);
		} catch (JsonParseException e) {
			e.printStackTrace();
		} catch (JsonMappingException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		String cusId = printlcd.getCusId();
		String woId = printlcd.getWoId();
		String lot_id = printlcd.getLot_id();
		String mtrlBoxId = printlcd.getMtrlBoxId();
		String planQty  = printlcd.getPlanQty();
		String mtrlCate = printlcd.getMtrlCate();//属性
		String jz  = printlcd.getJz();
		String fmMdlIdFk = printlcd.getFmMdlIdFk();
		String thMdlIdFk = printlcd.getThMdlIdFk();
		String prdQty = printlcd.getPrdQty();
		String boxId = printlcd.getBoxId();
		String crtTimestamp = printlcd.getCrtTimestamp();
		String mdlGuige = printlcd.getMdlGuige();
		String layoutIdFk = printlcd.getLayoutIdFk();
		List<String> prdId = printlcd.getPrdId();
		try {
			Integer loopCnt = 1;
			PrintYNK excel = new PrintYNK("1",loopCnt,false,cusId);
			//根据excel模板，新建workbook
			//生成工单令号，加工批号，箱号，并插入表格
			//woId,lot_id,mtrlBoxId
			HSSFWorkbook workbook = excel.creatWorkbook(woId,lot_id,mtrlBoxId);
			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
				//读取了workbook内sheet内容
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1)));
				//第一行
				HSSFCell cell = sheet.getRow(0).getCell(8);//加工批号
				cell.setCellValue(lot_id);

				//第二行
				cell = sheet.getRow(1).getCell(2);//工单号
				cell.setCellValue(woId);
				cell = sheet.getRow(1).getCell(8);//计划数量
				cell.setCellValue(planQty);
				cell = sheet.getRow(1).getCell(12);//属性
				cell.setCellValue(mtrlCate);
				//第三行
				cell = sheet.getRow(2).getCell(2);//机种
				cell.setCellValue(jz);
				cell = sheet.getRow(2).getCell(10);//客户代码
				cell.setCellValue(cusId);
				//第四行
				cell = sheet.getRow(3).getCell(2);//未减薄料号
				cell.setCellValue(fmMdlIdFk);
				cell = sheet.getRow(3).getCell(10);//减薄后料号
				cell.setCellValue(thMdlIdFk);
				//第五行
				cell = sheet.getRow(4).getCell(2);//玻璃数量
				cell.setCellValue(prdQty);
				cell = sheet.getRow(4).getCell(10);//包装箱号
				cell.setCellValue(boxId);
				//第六行
				cell = sheet.getRow(5).getCell(2);//来料箱号
				cell.setCellValue(mtrlBoxId);
				//第七行
				cell = sheet.getRow(6).getCell(2);//投料日期
				cell.setCellValue(crtTimestamp);
				//第八行
				cell = sheet.getRow(7).getCell(2);//基板型态
				cell.setCellValue(mdlGuige);
				//第九行
				cell = sheet.getRow(8).getCell(2);//排版数
				cell.setCellValue(layoutIdFk);

				//以下赋值玻璃ID
				if(prdId!=null && prdId.size() > 0){
					for (j = 0; j < 20; j++) {
						if(j >= prdId.size()){
							break;
						}
							if(!Util.isEmptyString(prdId.get(j))){
								cell = sheet.getRow(j+10).getCell(1);
								cell.setCellValue(prdId.get(j));
						}
					}
				}
			}

			String filename = excel.creatYNKFile(lot_id);
			FileOutputStream fileOut = new FileOutputStream(filename);
			workbook.write(fileOut);
			fileOut.flush();
			fileOut.close();
			excel.printExcel(printer,filename);
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}

	public void PrintYNKLCD2(final String printer,final String str){
		PrintDMLCD printdmlcd = new PrintDMLCD();
		System.out.println(str);
		try {
			printdmlcd = JackUtil.fromJson(str, printdmlcd);
		} catch (JsonParseException e) {
			e.printStackTrace();
		} catch (JsonMappingException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		String cusId = printdmlcd.getCusId();
		String lot_id = printdmlcd.getLot_id();
		String woId = printdmlcd.getWoId();
		String planQty = printdmlcd.getPlanQty();
		String mtrlCate = printdmlcd.getMtrlCate();
		String jz = printdmlcd.getJz();
		String fmMdlIdFk = printdmlcd.getFmMdlIdFk();
		String thMdlIdFk = printdmlcd.getThMdlIdFk();
		String prdQty = printdmlcd.getPrdQty();
		String boxId = printdmlcd.getBoxId();
		String mtrlBoxId = printdmlcd.getMtrlBoxId();
		String crtTimestamp = printdmlcd.getCrtTimestamp();
		String mdlGuige = printdmlcd.getMdlGuige();
		String layoutIdFk = printdmlcd.getLayoutIdFk();
		try {
			Integer loopCnt = 1;
			PrintYNK2 excel = new PrintYNK2("2", loopCnt, true, cusId);
			//根据excel模板，新建workbook
			HSSFWorkbook workbook = excel.creatWorkbook();
			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
				//读取了workbook内sheet内容
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1)));
				//第三行
				HSSFCell cell = sheet.getRow(2).getCell(4);//加工批号
				cell.setCellValue(lot_id);
				//第四行
				cell = sheet.getRow(3).getCell(1);//工单号
				cell.setCellValue(woId);
				cell = sheet.getRow(3).getCell(4);//计划数量
				cell.setCellValue(planQty);
				cell = sheet.getRow(3).getCell(6);//属性
				cell.setCellValue(mtrlCate);
				//第五行
				cell = sheet.getRow(4).getCell(1);//机种
				cell.setCellValue(jz);
				cell = sheet.getRow(4).getCell(5);//客户代码
				cell.setCellValue(cusId);
				//第六行
				cell = sheet.getRow(5).getCell(1);//未减薄料号
				cell.setCellValue(fmMdlIdFk);
				cell = sheet.getRow(5).getCell(5);//减薄后料号
				cell.setCellValue(thMdlIdFk);
				//第七行
				cell = sheet.getRow(6).getCell(1);//玻璃数量
				cell.setCellValue(prdQty);
				cell = sheet.getRow(6).getCell(5);//包装箱号
				cell.setCellValue(boxId);
				//第八行
				cell = sheet.getRow(7).getCell(1);//来料箱号
				cell.setCellValue(mtrlBoxId);
				//第九行
				cell = sheet.getRow(8).getCell(1);//投料日期
				cell.setCellValue(crtTimestamp);
				//第十行
				cell = sheet.getRow(9).getCell(1);//基板型态
				cell.setCellValue(mdlGuige);
				//第十一行
				cell = sheet.getRow(10).getCell(1);//排版数
				cell.setCellValue(layoutIdFk);
			}
			String filename = excel.creatYNKFile(lot_id);
			FileOutputStream fileOut = new FileOutputStream(filename);
			workbook.write(fileOut);
			fileOut.flush();
			fileOut.close();
			excel.printExcel(printer,filename);
		}catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}

	//ynk打印厦门天马出货单
	public void PrintForYNK006(final String printer ,final String str) {
		try {
			PrintYNK006 printData = new PrintYNK006();
			System.out.println(str);
			printData = JackUtil.fromJson(str, printData);
//			double stdQty = printData.getStdQty();
			double stdQty =30;
			String cusDsc = printData.getCusDsc();
			String mdlTyp = printData.getMdlTyp();
			String boxId = printData.getBoxId();
			String mdlId = printData.getMdlId();
			String modelCnt = printData.getModelCnt();
			String woId = printData.getWoId();
			List<String> prdAry = printData.getPrdAry();
			List<String> yjycAry = printData.getYjycAry();
			List<String> syAry = printData.getSyAry();
			List<String> cHsAry = printData.getcHsAry();
			List<String> cAdAry = printData.getcAdAry();
			List<String> cTdAry = printData.getcTdAry();
			List<String> cSsbjAry = printData.getcSsbjAry();
			List<String> cPsAry = printData.getcPsAry();
			List<String> cZwAry = printData.getcZwAry();
			List<String> cLyAry = printData.getcLyAry();
			List<String> cOtherAry = printData.getcOtherAry();
			List<String> tHsAry = printData.gettHsAry();
			List<String> tAdAry = printData.gettAdAry();
			List<String> tTdAry = printData.gettTdAry();
			List<String> tSsbjAry = printData.gettSsbjAry();
			List<String> tPsAry = printData.gettPsAry();
			List<String> tZwAry = printData.gettZwAry();
			List<String> tLyAry = printData.gettLyAry();
			List<String> tOtherAry = printData.gettOtherAry();
			List<String> remarkAry = printData.getRemarkAry();

			int loopCnt = (int) Math.ceil(stdQty / 30);

			PrintYNK3 excel = new PrintYNK3("5",loopCnt,true,"006");
			//根据excel模板，新建workbook
			HSSFWorkbook workbook = excel.creatWorkbook();
			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
				//读取了workbook内sheet内容
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1)));
				//第一行
				HSSFCell cell = sheet.getRow(3).getCell(1); //1.客户名称
				cell.setCellValue(cusDsc);
				cell = sheet.getRow(3).getCell(5);//2.产品规格
				cell.setCellValue(mdlTyp);
				cell = sheet.getRow(3).getCell(10);//3.原箱lot
				cell.setCellValue(boxId);
				cell = sheet.getRow(3).getCell(16);//4.箱内数量
				//5.不良cell总数  excel函数直接计算
				cell = sheet.getRow(3).getCell(19);
				//6.检验员  后期手K
				cell = sheet.getRow(3).getCell(21);
				//第二排
				cell = sheet.getRow(4).getCell(1); //7.产品型号
				cell.setCellValue(mdlId);
				cell = sheet.getRow(4).getCell(3);//8.生产批号
				cell.setCellValue(woId);
				cell = sheet.getRow(4).getCell(10);//9.出货检测日期
				cell.setCellValue(JackUtil.getCurDate());
				cell = sheet.getRow(4).getCell(16);//10.集成度   版式 11X5
				cell.setCellValue(modelCnt);
				//11.总良率  excel函数直接计算
				cell = sheet.getRow(4).getCell(19);

				for (j = 0; j < 30; j++, index++) {
					if (index <= stdQty) {
						cell = sheet.getRow(j + 9).getCell(0);
						cell.setCellValue(index);//序号

						if (prdAry != null && prdAry.size() > 0) {
							if (!Util.isEmptyString(prdAry.get(index - 1))) {
								cell = sheet.getRow(j + 9).getCell(1);
								cell.setCellValue(prdAry.get(index - 1));//基板ID号
							}
						}
						//液晶异常
						if (yjycAry != null && yjycAry.size() > 0) {
							if (!Util.isEmptyString(yjycAry.get(index - 1)) && Integer.parseInt(yjycAry.get(index - 1), 10) != 0) {
								cell = sheet.getRow(j + 9).getCell(2);
								cell.setCellValue(Integer.parseInt(yjycAry.get(index - 1), 10));
							}
						}
						//渗液
						if (syAry != null && syAry.size() > 0) {
							if (!Util.isEmptyString(syAry.get(index - 1)) && Integer.parseInt(syAry.get(index - 1), 10) != 0) {
								cell = sheet.getRow(j + 9).getCell(3);
								cell.setCellValue(Integer.parseInt(syAry.get(index - 1), 10));
							}
						}
						//C划伤 4
						if (cHsAry != null && cHsAry.size() > 0) {
							if (!Util.isEmptyString(cHsAry.get(index - 1)) && Integer.parseInt(cHsAry.get(index - 1), 10) != 0) {
								cell = sheet.getRow(j + 9).getCell(4);
								cell.setCellValue(Integer.parseInt(cHsAry.get(index - 1), 10));
							}
						}
						//C凹点
						if (cAdAry != null && cAdAry.size() > 0) {
							if (!Util.isEmptyString(cAdAry.get(index - 1)) && Integer.parseInt(cAdAry.get(index - 1), 10) != 0) {
								cell = sheet.getRow(j + 9).getCell(5);
								cell.setCellValue(Integer.parseInt(cAdAry.get(index - 1), 10));
							}
						}
					}

						//C凸点
						if(cTdAry != null && cTdAry.size() > 0) {
							if (!Util.isEmptyString(cTdAry.get(index - 1)) && Integer.parseInt(cTdAry.get(index - 1), 10) != 0) {
								cell = sheet.getRow(j + 9).getCell(6);
								cell.setCellValue(Integer.parseInt(cTdAry.get(index - 1), 10));
							}
						}

						//C酸蚀不匀
					if(cSsbjAry != null && cSsbjAry.size() > 0) {
						if (!Util.isEmptyString(cSsbjAry.get(index - 1)) && Integer.parseInt(cSsbjAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j + 9).getCell(7);
							cell.setCellValue(Integer.parseInt(cSsbjAry.get(index - 1), 10));
						}
					}
						//C破损
					if(cPsAry != null && cPsAry.size() > 0) {
						if (!Util.isEmptyString(cPsAry.get(index - 1)) && Integer.parseInt(cPsAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j + 9).getCell(8);
							cell.setCellValue(Integer.parseInt(cPsAry.get(index - 1), 10));
						}
					}
						//C脏污
					if(cZwAry != null && cZwAry.size() > 0) {
						if (!Util.isEmptyString(cZwAry.get(index - 1)) && Integer.parseInt(cZwAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j + 9).getCell(9);
							cell.setCellValue(Integer.parseInt(cZwAry.get(index - 1), 10));
						}
					}

						//C轮印
					if(cLyAry != null && cLyAry.size() > 0) {
						if (!Util.isEmptyString(cLyAry.get(index - 1)) && Integer.parseInt(cLyAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j + 9).getCell(10);
							cell.setCellValue(Integer.parseInt(cLyAry.get(index - 1), 10));
						}
					}
						//C其他不良
					if(cOtherAry != null && cOtherAry.size() > 0) {
						if (!Util.isEmptyString(cOtherAry.get(index - 1)) && Integer.parseInt(cOtherAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j + 9).getCell(11);
							cell.setCellValue(Integer.parseInt(cOtherAry.get(index - 1), 10));
						}
					}
						//T划伤
					if(tHsAry != null && tHsAry.size() > 0) {
						if (!Util.isEmptyString(tHsAry.get(index - 1)) && Integer.parseInt(tHsAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j + 9).getCell(12);
							cell.setCellValue(Integer.parseInt(tHsAry.get(index - 1), 10));
						}
					}
						//T凹点
					if(tAdAry != null && tAdAry.size() > 0) {
						if (!Util.isEmptyString(tAdAry.get(index - 1)) && Integer.parseInt(tAdAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j + 9).getCell(13);
							cell.setCellValue(Integer.parseInt(tAdAry.get(index - 1), 10));
						}
					}
						//T凸点
					if(tTdAry != null && tTdAry.size() > 0) {
						if (!Util.isEmptyString(tTdAry.get(index - 1)) && Integer.parseInt(tTdAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j + 9).getCell(14);
							cell.setCellValue(Integer.parseInt(tTdAry.get(index - 1), 10));
						}
					}
						//T酸蚀不匀
					if(tSsbjAry != null && tSsbjAry.size() > 0) {
						if (!Util.isEmptyString(tSsbjAry.get(index - 1)) && Integer.parseInt(tSsbjAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j + 9).getCell(15);
							cell.setCellValue(Integer.parseInt(tSsbjAry.get(index - 1), 10));
						}
					}
						//T破损
					if(tPsAry != null && tPsAry.size() > 0) {
						if (!Util.isEmptyString(tPsAry.get(index - 1)) && Integer.parseInt(tPsAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j + 9).getCell(16);
							cell.setCellValue(Integer.parseInt(tPsAry.get(index - 1), 10));
						}
					}
						//T脏污
					if(tZwAry != null && tZwAry.size() > 0) {
						if (!Util.isEmptyString(tZwAry.get(index - 1)) && Integer.parseInt(tZwAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j + 9).getCell(17);
							cell.setCellValue(Integer.parseInt(tZwAry.get(index - 1), 10));
						}
					}
						//T轮印
					if(tLyAry != null && tLyAry.size() > 0) {
						if (!Util.isEmptyString(tLyAry.get(index - 1)) && Integer.parseInt(tLyAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j + 9).getCell(18);
							cell.setCellValue(Integer.parseInt(tLyAry.get(index - 1), 10));
						}
					}
						//其他不良
					if(tOtherAry != null && tOtherAry.size() > 0) {
						if (!Util.isEmptyString(tOtherAry.get(index - 1)) && Integer.parseInt(tOtherAry.get(index - 1), 10) != 0) {
							cell = sheet.getRow(j + 9).getCell(19);
							cell.setCellValue(Integer.parseInt(tOtherAry.get(index - 1), 10));
						}
					}
						//备注
					if(remarkAry != null && remarkAry.size() > 0) {
						if (!Util.isEmptyString(remarkAry.get(index - 1))) {
							cell = sheet.getRow(j + 9).getCell(20);
							cell.setCellValue(remarkAry.get(index - 1));
						}
					}
					}

			}
			String filename = excel.creatBSDFile(boxId);
			FileOutputStream fileOut = new FileOutputStream(filename);
			workbook.write(fileOut);
			fileOut.flush();
			fileOut.close();
			excel.printExcel(printer,filename);
		} catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}

	public void PrintForYNKSC(final String printer,final String str){
		PrintLCDHX printlcdhx = new PrintLCDHX();
		System.out.println(str);
		try {
			printlcdhx = JackUtil.fromJson(str, printlcdhx);
		} catch (JsonParseException e) {
			e.printStackTrace();
		} catch (JsonMappingException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		String cusId = printlcdhx.getCusId();
		String woId = printlcdhx.getWoId();
		String woCateDsc = printlcdhx.getWoCateDsc();
		String lot_id = printlcdhx.getLot_id();
		 String[] lotID= lot_id.split("-");
		//String mtrlBoxId = printlcdhx.getMtrlBoxId();
		String planQty  = printlcdhx.getPlanQty();
		String mtrlCate = printlcdhx.getMtrlCate();//属性
		//String jz  = printlcdhx.getJz();
		String fmMdlIdFk = printlcdhx.getFmMdlIdFk();
		String thMdlIdFk = printlcdhx.getThMdlIdFk();
		String prdQty = printlcdhx.getPrdQty();
		//String boxId = printlcdhx.getBoxId();
		String crtTimestamp = printlcdhx.getCrtTimestamp();
		String[] crttime = crtTimestamp.split(" ");
		String mdlGuige = printlcdhx.getMdlGuige();
		String layoutIdFk = printlcdhx.getLayoutIdFk();
		List<String> prdId = printlcdhx.getPrdId();
		try {
			Integer loopCnt = 1;
			PrintYNK4 excel = new PrintYNK4("2", loopCnt, true, cusId);
			//根据excel模板，新建workbook
			HSSFWorkbook workbook = excel.creatWorkbook();
			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
				//读取了workbook内sheet内容
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1)));
				//第二行
				HSSFCell cell = sheet.getRow(1).getCell(0);//工单类型
				cell.setCellValue(woCateDsc);
				//第三行
				cell = sheet.getRow(2).getCell(1);//客户代码
				cell.setCellValue(cusId);
				cell = sheet.getRow(2).getCell(4);//加工批号
				cell.setCellValue(lot_id);
				cell = sheet.getRow(2).getCell(7);//加工内容
				cell.setCellValue(mtrlCate);
				cell = sheet.getRow(2).getCell(10);//排版
				cell.setCellValue(layoutIdFk);
				//第四行
				cell = sheet.getRow(3).getCell(1);//工单号
				cell.setCellValue(woId);
				cell = sheet.getRow(3).getCell(4);//计划数量
				cell.setCellValue(planQty);
				cell = sheet.getRow(3).getCell(10);//基板形态
				cell.setCellValue(mdlGuige);
				//第五行
				cell = sheet.getRow(4).getCell(1);//未减薄料号
				cell.setCellValue(fmMdlIdFk);
				cell = sheet.getRow(4).getCell(4);//减薄后料号
				cell.setCellValue(thMdlIdFk);
				cell = sheet.getRow(4).getCell(7);//玻璃数量
				cell.setCellValue(prdQty);
				cell = sheet.getRow(4).getCell(10);//投料日期
				cell.setCellValue(crttime[0]);

				//以下赋值玻璃ID
				if(prdId!=null && prdId.size() > 0){
							for(int y = 0,z = 0 ;y < 11;){
								for(int x = 5;x < 9; x++,z++){
									cell = sheet.getRow(x).getCell(y);
									if(z >= prdId.size()){
										break;
									}else{
										cell.setCellValue(prdId.get(z));
									}
								}
								y += 2;
							}

				}

			}
			String filename = excel.creatYNKFile(lot_id);
			FileOutputStream fileOut = new FileOutputStream(filename);
			workbook.write(fileOut);
			fileOut.flush();
			fileOut.close();
			excel.printExcel(printer,filename);
		}catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}


	}

	// ynk  打印华南生产工艺流程单
	public void PrintForYNKHN(final String printer,final String str){
		PrintYNKHN printynkhn = new PrintYNKHN();
		System.out.println(str);
		try {
			printynkhn = JackUtil.fromJson(str, printynkhn);
		} catch (JsonParseException e) {
			e.printStackTrace();
		} catch (JsonMappingException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		String cusId = printynkhn.getCusId();
		String woId = printynkhn.getWoId();
		String woCateDsc = printynkhn.getWoCateDsc();
		String lot_id = printynkhn.getLot_id();
		String[] lotID= lot_id.split("-");
		String mtrlBoxId = printynkhn.getMtrlBoxId();
		String planQty  = printynkhn.getPlanQty();
		String mtrlCate = printynkhn.getMtrlCate();//属性
		String jz  = printynkhn.getJz();
		String fmMdlIdFk = printynkhn.getFmMdlIdFk();
		String thMdlIdFk = printynkhn.getThMdlIdFk();
		String prdQty = printynkhn.getPrdQty();
		//String boxId = printlcdhx.getBoxId();
		String crtTimestamp = printynkhn.getCrtTimestamp();
		String[] crttime = crtTimestamp.split(" ");
		String mdlGuige = printynkhn.getMdlGuige();
		String oldBox =printynkhn.getOldBox();
		String layoutIdFk = printynkhn.getLayoutIdFk();
		List<String> prdId = printynkhn.getPrdId();
		try {
			Integer loopCnt = 1;
			PrintHNLCD excel = new PrintHNLCD("2", loopCnt, true, cusId);
			//根据excel模板，新建workbook
			HSSFWorkbook workbook = excel.creatWorkbook();
			int i;
			int j;
			int index = 1;
			for (i = 0; i < loopCnt; i++) {
				//读取了workbook内sheet内容
				HSSFSheet sheet = workbook.getSheet("sheet" + (String.valueOf(i + 1)));
				//第二行
				HSSFCell cell = sheet.getRow(1).getCell(0);//工单类型
				cell.setCellValue(woCateDsc);
				//第三行
				cell = sheet.getRow(2).getCell(1);//客户代码
				cell.setCellValue(cusId);
				cell = sheet.getRow(2).getCell(4);//加工批号
				cell.setCellValue(lot_id);
				cell = sheet.getRow(2).getCell(7);//加工内容
				cell.setCellValue(mtrlCate);
				cell = sheet.getRow(2).getCell(10);//排版
				cell.setCellValue(layoutIdFk);
				//第四行
				cell = sheet.getRow(3).getCell(1);//工单号
				cell.setCellValue(woId);
				cell = sheet.getRow(3).getCell(4);//计划数量
				cell.setCellValue(planQty);
				cell = sheet.getRow(3).getCell(7);//产品尺寸
				cell.setCellValue(jz);
				cell = sheet.getRow(3).getCell(10);//是否原箱回
				cell.setCellValue(oldBox);
				//第五行
				cell = sheet.getRow(4).getCell(1);//未减薄料号
				cell.setCellValue(fmMdlIdFk);
				cell = sheet.getRow(4).getCell(4);//减薄后料号
				cell.setCellValue(thMdlIdFk);
				cell = sheet.getRow(4).getCell(7);//玻璃数量
				cell.setCellValue(prdQty);
				cell = sheet.getRow(4).getCell(10);//投料日期
				cell.setCellValue(crttime[0]);
				cell = sheet.getRow(10).getCell(9); // 来料箱
				cell.setCellValue(mtrlBoxId);
				cell = sheet.getRow(11).getCell(9); // 基板形态
				cell.setCellValue(mdlGuige);
				//以下赋值玻璃ID
				int b=0;
				if(prdId!=null && prdId.size() > 0){
					for(int y = 0,z = 0 ;y < 11;){
						for(int x = 6;x < 10; x++,z++){
							cell = sheet.getRow(x).getCell(y);
							if(z >= prdId.size()){
								break;
							}else{
							    b=b+1;
							    if(b<10){
									cell.setCellValue("0"+b+". "+prdId.get(z));
								}else {
									cell.setCellValue(b+". "+prdId.get(z));
								}
							}
						}
						y += 2;
					}

				}

			}
			String filename = excel.creatYNKFile(lot_id);
			FileOutputStream fileOut = new FileOutputStream(filename);
			workbook.write(fileOut);
			fileOut.flush();
			fileOut.close();
			excel.printExcel(printer,filename);
		}catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}


	}



	public void PrintTEST(final String boxID ) {
		try{
			
			PrintHCT excel = new PrintHCT("E",1,false);
			//根据excel模板，新建workbook 
			HSSFWorkbook workbook = excel.creatWorkbook();
		    //读取了workbook内sheet内容  
		    HSSFSheet sheet = workbook.getSheet("sheet1");
		    //shape
		    HSSFCell cell = null;
		    HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
		    HSSFClientAnchor hc = new HSSFClientAnchor( 0, 0, 200, 100, (short) 1, 0, (short) 1, 0 );
		    HSSFSimpleShape shape1 = patriarch.createSimpleShape(hc);
		    shape1.setShapeType(HSSFSimpleShape.OBJECT_TYPE_RECTANGLE);
		    shape1.setFillColor(IndexedColors.ORANGE.getIndex());
		    //
		    cell = sheet.getRow(1).getCell(0);
		    cell.setCellValue(boxID);
		    cell = sheet.getRow(0).getCell(1);
		    cell.setCellValue("型号：");
		    cell = sheet.getRow(1).getCell(1);
		    cell.setCellValue("数量："  + "Sheet");
		    cell = sheet.getRow(3).getCell(1);
		    cell.setCellValue("客户出货PO：" );
	        String filename = excel.creatPalletFile();
			FileOutputStream fileOut = new FileOutputStream(filename);  
			workbook.write(fileOut); 
			fileOut.flush();
			fileOut.close(); 
	        excel.printExcel("",filename);
		}catch (Exception ex) {
			ex.printStackTrace();
			System.out.println(ex.toString());
		}
	}
	
	//wg018客户标签
	public void Print018(final String printer, final String ps, final String mkr,
            final String wocate, final String mtrlId, final String qty,final String jgyq,final String date,
            final String outdate,final String boxId,final String thickness,final String dir,final String user,
            final String note) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
	
				ActiveXComponent axc = new ActiveXComponent("pt1.ct35");
	
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct35",printer, ps,mkr,wocate,mtrlId,qty,
							jgyq,date,outdate,boxId,thickness,dir,user,note);

				return null;
			}
		});
	}
	
	//wg018list
	public void PrintFor018ShtList(final String printer,final String title, final String jsonAry, final String boxId) {
	AccessController.doPrivileged(new PrivilegedAction<Object>() {
		@Override
		public Object run() {
			ObjectMapper mapper = new ObjectMapper();
			String[] ja = null;
			try {
				ja = mapper.readValue(jsonAry, String[].class);
			} catch (Exception e) {
				System.out.println("Error took place");
				e.printStackTrace();
			}
			String sht1 = "";
			String sht2 = "";
			String sht3 = "";
			String sht4 = "";
			String sht5 = "";
			String sht6 = "";
			String sht7 = "";
			String sht8 = "";
			String sht9 = "";
			String sht10 = "";
			String sht11 = "";
			String sht12 = "";
			String sht13 = "";
			String sht14 = "";
			String sht15 = "";
			String sht16 = "";
			String sht17 = "";
			String sht18 = "";
			String sht19 = "";
			String sht20 = "";
			
		
			sht1 = ja[0];
			sht2 = ja[1];
			sht3 = ja[2];
			sht4 = ja[3];
			sht5 = ja[4];
			sht6 = ja[5];
			sht7 = ja[6];
			sht8 = ja[7];
			sht9 = ja[8];
			sht10 = ja[9];
			sht11 = ja[10];
			sht12 = ja[11];
			sht13 = ja[12];
			sht14 = ja[13];
			sht15 = ja[14];
			sht16 = ja[15];
			sht17 = ja[16];
			sht18 = ja[17];
			sht19 = ja[18];
			sht20 = ja[19];
			
			System.out.println("Start2");
			ActiveXComponent axc = new ActiveXComponent("pt1.ct36");
	
				Dispatch dispatch = axc.getObject();
				Variant v = Dispatch.call(dispatch, "ct36", printer, title,sht1,sht2,sht3,sht4,sht5,sht6,sht7,sht8,sht9,sht10,
						sht11,sht12,sht13,sht14,sht15,sht16,sht17,sht18,sht19,sht20,boxId);

			return null;
		}
	});
}
	//wg211客户标签
	public void Print211(final String printer, final String cnBox, final String mkr,
            final String wocate, final String mtrlId, final String qty,final String jgyq,final String date,
            final String outdate,final String boxId,final String thickness,final String dir,final String user,
            final String note) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
	
				ActiveXComponent axc = new ActiveXComponent("pt1.ct40");
	
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct40",printer, cnBox,mkr,wocate,mtrlId,qty,
							jgyq,date,outdate,boxId,thickness,dir,user,note);

				return null;
			}
		});
	}
	
	//hc-shtlist
	public void PrintHCTshtList(final String printer, final String boxId, final String jsonAry) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {

				System.out.println("Start2");
				ObjectMapper mapper = new ObjectMapper();
				String[] ja = null;
				try {
					ja = mapper.readValue(jsonAry, String[].class);
				} catch (Exception e) {
					System.out.println("Error took place");
					e.printStackTrace();
				}
				String sht = "";
				for(int i=0;i<40;i++){
					sht = sht + ja[i] + ",";
				}
				ActiveXComponent axc = new ActiveXComponent("pt1.ct41");
	
					Dispatch dispatch = axc.getObject();
					Variant v = Dispatch.call(dispatch, "ct41",printer,boxId,sht);

				return null;
			}
		});
	}
	
	//qrcode picture
		public void PrintQR(final String printer, final String str) {
		
			Qrcode rcode = new Qrcode();
			rcode.setQrcodeVersion(3);
			byte[] content=null;
			try {
				content = str.getBytes("utf-8");
			} catch (UnsupportedEncodingException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
			BufferedImage bufImg = new BufferedImage(300, 300,
						        BufferedImage.TYPE_INT_RGB);
			
			Graphics2D gs = bufImg.createGraphics(); 
			gs.setBackground(Color.WHITE);
			gs.clearRect(0, 0, 300, 300); 
			gs.setColor(Color.BLACK); 
			if (content.length > 0 && content.length < 120) {
	            boolean[][] codeOut = rcode.calQrcode(content);
	            for (int i = 0; i < codeOut.length; i++) {
	                for (int j = 0; j < codeOut.length; j++) {
	                    if (codeOut[j][i]) {
	                        gs.fillRect(j * 10 + 5, i * 10 + 5, 10, 10);
	                    }
	                }
	            }
	            System.out.println("OK");
	        } else {
	            System.err.println("QRCode content bytes length = " + content.length + " not in [ 0,120 ]. ");
	        }
	        gs.dispose();
	        bufImg.flush();
	        File imgFile = new File("C:\\MESRP\\qr.jpg");
	        try {
	            ImageIO.write(bufImg, "jpg", imgFile);
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
		}
		
		//qrcode hc
		public void PrintQRhc(final String printer) {
			AccessController.doPrivileged(new PrivilegedAction<Object>() {
				@Override
				public Object run() {

					System.out.println("Start2");
					ActiveXComponent axc = new ActiveXComponent("pt1.ct43");
		
						Dispatch dispatch = axc.getObject();
						Variant v = Dispatch.call(dispatch, "ct43",printer);

					return null;
				}
			});
		}
		//unk  huaxing
		public void PrintboxforHX(final String printer, final String partNo,final String dpBox, final String prdQty,final String SID,final String vendor) {
			AccessController.doPrivileged(new PrivilegedAction<Object>() {
				@Override
				public Object run() {

					System.out.println("Start2");
					
					ActiveXComponent axc = new ActiveXComponent("pt1.ct49");
			
						Dispatch dispatch = axc.getObject();
						Variant v = Dispatch.call(dispatch, "ct49", printer, partNo, dpBox,prdQty,SID,vendor);

					return null;
				}
			});
		}
		public void PrintpalforHX(final String printer, final String mtrlId,final String BoxQty, final String totalQty,final String palletId,final String vendor) {
			AccessController.doPrivileged(new PrivilegedAction<Object>() {
				@Override
				public Object run() {

					System.out.println("Start2");
					
					ActiveXComponent axc = new ActiveXComponent("pt1.ct50");
			
						Dispatch dispatch = axc.getObject();
						Variant v = Dispatch.call(dispatch, "ct50", printer, mtrlId, BoxQty,totalQty,palletId,vendor);

					return null;
				}
			});
		}
}
